Skip to main content


1 reply [Last post]
Joined: 2009-06-07

I have a JTable from which I need to insert data to a database. I need to implement the functionality of data adding like this:
User will fill in all (or some) cells in a row, and when the focus is passed to another row (I need to detect it) the data will be collected from all the cells of that row and be inserted in the database. I tried to write my own TableModel which implements the TableModelListener interface and use its tableChanged(TableModelEvent e) method, but it's triggered for each change in a single cell. I need to detect changes between rows and if any of the cells has changed then make the update to the database, if none of the cells has changed do nothing. I also tried something with ListSelectionListener, which helps to detect the selections in JTable rows, but got stuck somewhere and couldn't make it work as I exactly want.
It'll be exactly like adding data in a table of MS Access. Any ideas how to make it work???
I'd appreciate it very much if somebody could help me.
Thanks in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2012-12-10

Hi.. It's two years too late, but I have a close answer.
I have made a UI library named iGrid.
You can find it here.