Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JTables and Cell Editor

 
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
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • 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.
 
What a show! What atmosphere! What fun! What a tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic