Container contentPane = dialog.getContentPane();
contentPane.setLayout(new BoxLayout(contentPane,BoxLayout.Y_AXIS));
JLabel lbl = new JLabel(I18N.gettext("groupchat.bookmarks"));
lbl.setAlignmentX(0.5f);
contentPane.add(lbl);
final TableSorter sorter = new TableSorter(conferencesTableModel);
final JTable table = new JTable(sorter);
sorter.setTableHeader(table.getTableHeader());
sorter.setSortingStatus(0, TableSorter.ASCENDING);
table.setAlignmentX(0.5f);
table.setPreferredScrollableViewportSize(new Dimension(200, 100));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel sm = table.getSelectionModel();
sm.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
ListSelectionModel lsm =
(ListSelectionModel)e.getSource();
delButton.setEnabled(!lsm.isSelectionEmpty());
}
});
final JList list = new JList(conferences.toArray());
list.setAlignmentX(0.5f);
JScrollPane listScroller = new JScrollPane(table);
contentPane.add(listScroller);
delButton =
new JButton(I18N.gettext("groupchat.delete_bookmark"));
delButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int i = sorter.modelIndex(table.getSelectedRow());
if(i != -1) {
conferences.remove(i);
conferencesTableModel.update();
storeConferences();
dialog.dispose();