I’m coding in Swing in Java. I’m using the Netbeans layout manager. I’m having trouble with a jTable. I’ve applied a customer model to it which extends AbstractTableModel. I want the third column to contain boolean values in the form of checkboxes (this I have done successfully). The dialog I have the jTable in implements TableModelListener. My tableChanged() method has only the following code: System.out.println("Table changed!");
However, whenever I try to check one of the checkboxes, it does the little “suppression” thing when I click and hold, then when I release, it doesn’t change the checkbox’s state. It also does not print out “The table has changed!” This has been driving me crazy. I’ve read all about it, but can’t figure out why mine’s not working. Please help. Here’s the relevant code:
In jDialog constructor:
this.chapterTableModel = new ChapterTableModel(chapterList);
chapterTableModel.addTableModelListener(this);
And then a method which does this: chapterTable.setModel(chapterTableModel);
Then below my constructor, I have this method:
@Override
public void tableChanged(TableModelEvent tme) {
System.out.println("Table Changed!");
}
The entire code can be found here: http://collabedit.com/ttcds
and here: http://collabedit.com/qn3kx
Thanks for your help in advance!
You are not overriding setValueAt anywhere so the value in your table isn’t being changed.