I want to enable/disable a table cell based on the contents of another cell. e.g. if the reference cell value is "true", then enable the cell, otherwise disable the cell. I have set up isCellEditable() to do this and it works if the reference cell already has a value when bringing the table up. But if the user changes the value, isCellEditable() does not get called and so the cell is not enabled/disabled. So I need to have isCellEditable() called when the reference cell value changes and use that to set the cell. something like:
setCellEditable(isCellEditable(row,column), row, column)
but I don't see a method like setCellEditable.
How is this done?
@Override
public boolean isCellEditable(int row, int column) {
if (column == 3) {
String value = (String) defaultTableModel.getValueAt(row, 3);
if (value.equalsIgnoreCase("true")) {
return true;
}
return false;
}
}