jQuery in Action, 2nd edition*
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 Android Security Essentials Live Lessons this week in the Android 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)
 
 
subject: Updating data in the JTable
 
Similar Threads
JTable
JTable
JTable
jtable
JTable