Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable refresh  RSS feed

 
Nikolay Tsonkov
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am working with a simple JTable. I know how to update the data in the table. The table overrides prepareRenderer and getToolTipText methods in order to add coloring and tooltips to the cells. The values that determine the way cells would be colored and the data in the tool tips are passed through the constructor of the class that extends JTable. And the problem is that these values can't be updated. Even if add setter methods in that class they cannot be accessed by the main class except the overridden methods. If I initialize the table class again with the button the table disappears.
The following excerpt is from the refresh button in the JPanel:


And the next one is the class that extends JTable:


Any advices and suggestions would be accepted gratefully. Please let me know if I am missing anything or if I have to provide more code.
Thanks>
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the problem is that these values can't be updated.


If you have access the the method that updates your values then you can change the values. You will need to add a table.repaint() afterwards to force the table to repaint itself using the new values.
 
Nikolay Tsonkov
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I've tried the repaint() method but it doesn't help. PrerequisiteTable class repaints the table too...
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why dont you do the adding using the jtable's defaulttablemodel? then call jtable.setModel()?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!