The table does not know it should repaint the cell in column 2 when column 1 was modified. You can notify the table by firing an update manually. For example, extend model's setValueAt()
:
@Override
public void setValueAt(Object aValue, int row, int column) {
super.setValueAt(aValue, row, column);
if (column == 1)
fireTableRowsUpdated(row, row);
}
This will disable the editor and spinner will become not editable. If you need to actually disable the spinner visually, then, inside the renderer you can enable/disable the spinner based on isCellEditable
, ie:
spinner.setEnabled(table.isCellEditable(row, column));
Note that in your current implementation you extend JTable
to implement isCellEditable
and setValueAt
. These should really be part of the model.