/** Creates a new instance of JColChooserDialog */
public JColChooserDialog(JMainFrame frame, JColChooserData[] dataArray)
{
super(frame, true);
setTitle(Main.getString("colchooser_caption"));
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
JPanel panel = new JPanel();
Arrays.sort(dataArray, new JColChooserDataComparator(true));
for (JColChooserData data : dataArray)
{
m_comboBox.addItem(data);
}
m_comboBox.setBorder(new EmptyBorder(10, 0, 0, 0));
Dimension dim = m_comboBox.getPreferredSize();
m_comboBox.setPreferredSize(new Dimension(200, (int)dim.getHeight()));
panel.add(m_comboBox);
JPanel panel2 = new JPanel();
panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
panel2.setBorder(new EmptyBorder(5, 0, 10, 10));
panel2.add(Box.createHorizontalGlue());
JButton ok = new JButton(Main.getString("ok"));
ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
m_bOk = true;
dispose();
}
});
dim = ok.getPreferredSize();
ok.setPreferredSize(new Dimension(100, (int)dim.getHeight()));
panel2.add(ok);
panel2.add(Box.createRigidArea(new Dimension(5, 0)));
JButton cancel = new JButton(Main.getString("cancel"));
cancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
dispose();
}
});
dim = cancel.getPreferredSize();
cancel.setPreferredSize(new Dimension(100, (int)dim.getHeight()));
panel2.add(cancel);
cp.add(panel, BorderLayout.NORTH);
cp.add(panel2, BorderLayout.SOUTH);
setPreferredSize(new Dimension(240, 130));
setResizable(false);
setLocationRelativeTo(frame);
pack();