Java Reference
In-Depth Information
new EtchedBorder(), // Border to use
"Line Color")); // Border title
leftPanel.add(left, BorderLayout.CENTER);
// Create right columns of checkboxes with struts and glue as above...
// Create a panel with a titled border to hold the right Box container
JPanel rightPanel = new JPanel(new BorderLayout());
rightPanel.setBorder(new TitledBorder(
new EtchedBorder(), // Border to use
"Line Properties")); // Border title
rightPanel.add(right, BorderLayout.CENTER);
// Create top row to hold left and right
Box top = Box.createHorizontalBox();
top.add(leftPanel);
top.add(Box.createHorizontalStrut(5)); // Space between vertical boxes
top.add(rightPanel);
// Create bottom row of buttons
JPanel bottomPanel = new JPanel();
bottomPanel.setBorder(new CompoundBorder(
BorderFactory.createLineBorder(Color.black, 1), // Outer border
BorderFactory.createBevelBorder(BevelBorder.RAISED))); // Inner border
// Create and add the buttons as before...
Container content = aWindow.getContentPane(); // Set the container layout mgr
BoxLayout box = new BoxLayout(content, BoxLayout.Y _ AXIS);
// Vertical for content pane
content.setLayout(box); // Set box layout manager
content.add(top);
content.add(bottomPanel);
aWindow.setVisible(true); // Display the window
}
}
The example will now display the window shown below.
Search WWH ::




Custom Search