Reputation: 483
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?
Upvotes: 1
Views: 1527
Reputation: 347204
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...
Upvotes: 2