• 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

JTable refresh

 
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>
 
Rancher
Posts: 3191
29
  • 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...
 
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()?
 
I am going to test your electrical conductivity with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic