Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable is not getting refreshed.

 
Raj Sikka
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • 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
 
Joe Ess
Bartender
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic