I think there are 2 ways to do that.
One way is to addTableModelListener to your tablemodel.
yourTableModel.addTableModelListener(new TableModelListener() {
public void tableChanged (TableModelEvent e) {
int row = e.getFirstRow();
int column = e.getColumn();
String columnName = model.getColumnName(column);
Object data = model.getValueAt(row, column);
...// Do something with the data...
}
}
});
Another way is to override setValueAt method in your tableModel.
public void setValueAt(Object value, int row, int col) {
//You get rowNumber , columnNumber and new value here
//Do something with the data.
}
At last there is something that you have to know. If the CellEditor doesn't get a "stopCellEditing" call, the underlying DataModel doesn't get updated via setValueAt(value, row, col).So you have to stop the CellEditor programmatically by adding one line yourTable.getCellEditor().stopCellEditing();
Good luck!