aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Updating data in the JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Updating data in the JTable" Watch "Updating data in the JTable" New topic
Author

Updating data in the JTable

Flora Ng
Greenhorn

Joined: Jul 05, 2001
Posts: 11
How can I update the cell values in the JTable?
I use the AbstractTableModel class and the values are in the form of Object array.
Thanks...
Bob Hendry
Greenhorn

Joined: Sep 21, 2000
Posts: 19
Not an easy thing. You have to get the rows that have been added or changed and build the SQL to insert or update them in the database.
Use listeners to determine "what" has changed. Loop through the rows in the table model and issue the appropriate SQL
What you want to do is not an easy task........
Nathanael Ulrick
Greenhorn

Joined: Jul 17, 2001
Posts: 22
I'm not sure whether Flora wants to use SQL. If she already knows what's changed, then it's simply a matter of updating the appropriate Object in the array, then calling:
yourtablemodel.fireTableCellUpdated(row, column)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updating data in the JTable