i'd like to set my JTable selectable but not editable. What is the best way to do this in my code?
DefaultTableModel table = toernooi.getToernooien();
tbl_toernooi.setModel(table);
tbl_toernooi.setRowSelectionAllowed(true);
i'd like to set my JTable selectable but not editable. What is the best way to do this in my code?
DefaultTableModel table = toernooi.getToernooien();
tbl_toernooi.setModel(table);
tbl_toernooi.setRowSelectionAllowed(true);
Just make sure that the isCellEditable()
method of the table model of the table returns false. The DefaultTableModel implementation of this method returns true, so you'll have to subclass it, and override the method to return false.