6.7. ButtonBox

The ButtonBox container is designed to contain a group of buttons. An example from TestGTK is below.

Example 6-7. TestGTK.java - ButtonBox

	private Frame createButtonBox(boolean horizontal, String title, int spacing, 
		int childWidth, int childHeight, ButtonBoxStyle layout) {
		ButtonBox box;

		Frame frame = new Frame(title);
		if (horizontal) {
			box = new HButtonBox();
		} else {
			box = new VButtonBox();
		}

		box.setBorderWidth(5);
		frame.add(box);

		box.setLayout(layout);
		box.setSpacing(spacing);

		Button button;
		button = new Button("OK", false);
		box.add(button);
		button = new Button("Cancel", false);
		box.add(button);
		button = new Button("Help", false);
		box.add(button);

		return frame;
	}