JTable to block the modification of Java cells


I would like to know how to block the modification of the cells.

asked by Bruno 11.11.2016 в 19:23

1 answer


It can be done by implementing the method boolean isCellEditable(int row, int column) of DefaultTableModel .

As you say that what you want is to make some rows editable and others not, you must implement what condition makes them editable / not editable and you return with a true / false . But it's done at cell level . Then you can propagate the value to the rest of the cells to serve the entire row. This way you will know which rows are editable and which ones are not.

answered by 11.11.2016 в 19:38