• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTables and Cell Editor  RSS feed

 
Saniya Ansari
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using JTable to display data that i retrieve from the database. The user should be able to edit one of the columns. I've got a cell editor attached to that column and it returns the value i want. The problem is that this change doesnt appear on the table. So i assume that the data model hasnt changed or what. Which method should i override or call to ensure that the display changes as well.. Or is there any mehtod that can reset the JTable and draw it again. HELP
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saniya,
I may be stating the overly obvious to you, but modifying the "TableModel" will not modify the data in the database. Somewhere in your implementation of "TableModel" needs to be (JDBC) code that updates the database with the value entered into the "JTable".
Also, the "JTable" 'listens' to its "TableModel", so after modifying the data in your "TableModel", you should invoke the appropriate "fireTableXXX()" method (defined in "javax.swing.table.AbstractTableModel").
Hope this will help you.
Good Luck,
Avi.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!