- //Create a container so that we can add a title around
- //the scroll pane. Can't add a title directly to the
- //scroll pane because its background would be white.
- //Lay out the label and scroll pane from top to bottom.
- JPanel listPane = new JPanel();
- listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
-
- JLabel label = new JLabel("Select Device");
- label.setLabelFor(selected_devices);
- listPane.add(label);
- listPane.add(Box.createRigidArea(new Dimension(0,5)));
- listPane.add(selected_list_scroller);
- listPane.add(visible_list_scroller);
- listPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
- //Lay out the buttons from left to right.
- JPanel buttonPane = new JPanel();
- buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
- buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
- buttonPane.add(Box.createHorizontalGlue());
- buttonPane.add(cancelButton);
- buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
- buttonPane.add(selectButton);
-
- //Put everything together, using the content pane's BorderLayout.
- Container contentPane = getContentPane();
- contentPane.add(listPane, BorderLayout.CENTER);
- contentPane.add(buttonPane, BorderLayout.PAGE_END);
-
- //Initialize values.
-// list.setSelectedValue(initial, true);