I want disable editing Column 1 to Column 9 when Column 0 CheckBox is false and Checkbox value is true enable editing Column 1 to Column 9 when Column 0....How to do that?
Asked
Active
Viewed 1,513 times
1 Answers
2
You need to override the isCellEditable
method from the TableModel
...for example
public boolean isCellEditable(int rowIndex, int columnIndex) {
boolean isEditable = false;
if (columnIndex >= 1 && columnIndex <= 9) {
Object value = getValueAt(rowIndex, 0);
if (value instance Boolean) {
isEditable = !((boolean)value);
}
} else {
// Other columns...
}
return isEditable
}
Check out TableModel
and How to use tables for more details...

MadProgrammer
- 343,457
- 22
- 230
- 366
-
+1 similair way solved here a few times (edit I'd be to test for boolean, then allowing row index) – mKorbel May 11 '13 at 06:50