this.title = title;
}
public void actionPerformed(ActionEvent e) {
// show testbed list
final CheckBoxJList lb = new CheckBoxJList();
final DefaultListModel lm = new DefaultListModel();
if (addColumn) {
for (int i = 1; i < JTreeTable.this.getModel().getColumnCount(); i++) {
if (JTreeTable.this.convertColumnIndexToView(i) == -1) {
lm.addElement(JTreeTable.this.getModel().getColumnName(i));
}
}
} else {
for (int i = 1; i < JTreeTable.this.getColumnCount(); i++) {
lm.addElement(JTreeTable.this.getColumnName(i));
}
}
lb.setModel(lm);
// open a dialog showing this
final JDialog dlg = new JDialog();
dlg.setLayout(new BorderLayout());
dlg.setTitle(title);
dlg.add(new JScrollPane(lb));
JPanel buttonPanel = new JPanel(new BorderLayout());
JButton okButton = new JButton("Ok");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// remove the columns
for (int index = 0; index < lm.getSize(); index++) {
String testbedName = (String) lm.getElementAt(index);
if (lb.isIndexSelected(index)) {
// check the correct
for (int colIndex = 1; colIndex < JTreeTable.this.getModel().getColumnCount(); colIndex++) {
String colName = JTreeTable.this.getModel().getColumnName(colIndex);
if (colName.equals(testbedName)) {
// remove the column