I’m building and app with multiple JTables and I need to detect when cell value change occurs so I can update it in the database. I tried TableModelListener and overriding tableChanged, but it fires only when I click away (click on another row) after I have edited a cell.
Any other way to do this?
You can implement the
CellEditorListenerinterface, as shown in this example. Note thatJTableitself is aCellEditorListener.It may also be convenient to terminate the edit when focus is lost, as shown here:
More Swing client properties may be found here.