Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTable using TableModels: Cell edit committed on press of a button

843805Apr 5 2007
Hi,

I went through the forum posts related to JTable but was unfortunate not to find anything that resembled my query.

Here is where i am at:::
I have a JTable which is backed by my TableModel. The table model is populated with data from a database table.

The data is clearly displayed, the cells are editable, i have a TableModelListener( ) listening to any changes made to the table. So if i were to click on a cell and change the value, i see that the modelListener gets called.

Here is where i am stuck:::
I have two buttons on the same panel, which are say "Commit Changes" and "Do not commit changes"

I would like the changes made to the cell(s) committed ONLY on the correct button being pressed, and the changes rolledback if the other is pressed.

This whole thing is being done using MVC architecture, so i have my own actions that are passed to the button, which in turn calls a model to update the db. BUT i cant seem to link the cell being edited and the buttons

any ideas, suggestions, a finger pointed to a direction...

thank you,

-U
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2007
Added on Apr 5 2007
0 comments
148 views