I have given you the coding which lays out the GUI. This code is in the constructor for the dialog, which is implemented as a JDialog subclass. So have a look at the sample of code :
Code:
JScrollPane listScroller = new JScrollPane(list);
listScroller.setPreferredSize(new Dimension(320, 110));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
...
JPanel listPane = new JPanel();
listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
JLabel label = new JLabel(labelText);
...
listPane.add(label);
listPane.add(Box.createRigidArea(new Dimension(0,7)));
listPane.add(listScroller);
listPane.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 20, 20));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(20, 0)));
buttonPane.add(setButton);
Container contentPane = getContentPane();
contentPane.add(listPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.PAGE_END);
Bookmarks