• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable is not getting refreshed.

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a class which implements TableModel.
Inside the class i am using a JTable which has dynamic data.
So i need to refresh the JTable whenever data changes.
For that i am using following lines:
jtable.repaint();
jtable.invalidate();
But i couldnt refresh the JTable .It is showing old data.
I read somewhere that i need to refresh the "model" not the "jtable".
If it is true , how to refresh TableModel?
Pls suggest some solution.
Appriciate any Code samples.
Thanks,
Raj
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you did not create your own data model, you can invoke the appropriate fireTable*() method on the data model. This will send an event to the data model's listeners (the JTable being one of them) that the data has changed. Look at the documentation for the an explanation of the various fireTable*() methods.
 
reply
    Bookmark Topic Watch Topic
  • New Topic