i have a jtable with multiple editable cells
when someone presses the "save button" on the menu, it doesn't save the last value that is still currently being edited. (unless they tab out of the cell first)
i can check it is being edited by calling .isEditing() which returns true.
What i would prefer to do is trigger that the cell editing is complete, and it can show any validation errors, and if none, then save. (without the user having to tab out first)
can someone please point me in the right direction
thanks
You can manually call:
JTable table;
table.getCellEditor().stopCellEditing();
This should cause the table to stop editing at that cell. By overriding the stopCellEditing()
method of your TableCellEditor
and returning false under certain circumstances, you can indicate that the cell's value is currently invalid and thus editing cannot be stopped at that time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With