Hi Im doing a project for college and have a JTable in my GUI. I want the user to be able to select rows without being able to change the data in the table. I am using two arrays to crate the table not the table model. Thanks
I dont want to use tablemodels!!!!
You can implement the isEditable() method in your table model and return false and your table will not be editable:
Then you have a table and you set its model to a MyTableModel object eg.
Extra Information:
AbstractTableModel.isCellEditable(int,int)returns false by default, so you don’t need to override it to get that behavior.The
DefaultTableModelimplementation of that method returns true by default, so that one must be overriden if you wish to make cells un-editable.Resource of this answer.