isCellEditable (int row, int col)
This method determines which rows and columns the user is allowed to modify. Since this method returns a boolean if all cells are editable, it simply returns true. To prevent JTable from changing a specific column or row value, it returns false from this method. The following code allows you to display only one column, allowing you to change the remaining columns.
while allowing the user to edit at
all
If (col == 1){
return false;
}
else{
return true;
}
public void setValueAt(Object value, int row, int col)
, . , , , . , . , , , , . JTable, . , , JTable. , . ( ) , JTable.
// Update the array of objects with
// the changes the user has just entered in a cell.
// Then notify all listeners (if any) what column
// and row has changed. Further processing may take place there.
rowData[row][col] = value;
fireTableDataChanged();