File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating data in the JTable

 
Flora Ng
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic