Game Development Community

Java non-editable JTables

by Steven Fletcher · in Technical Issues · 04/25/2005 (7:54 pm) · 1 replies

Look, this is going to sound really stupid, but...

How do you make JTables non-editable???

There's no setEditable method, and setting the cell editor to null doesn't seem to do the trick.

#1
04/27/2005 (7:34 pm)
Never mind. I figured it out. You just have to override the TableModel. If anyone else gets stuck on this, take a look at the following code:

DefaultTableModel tableModel = new DefaultTableModel(aaData, aQuestTableHeader) {
   public boolean isCellEditable(int row, int column) {return false;}
};
questTable.setModel(tableModel);