aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable is not getting refreshed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable is not getting refreshed." Watch "JTable is not getting refreshed." New topic
Author

JTable is not getting refreshed.

Raj Sikka
Ranch Hand

Joined: Apr 11, 2003
Posts: 34
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

Joined: Oct 29, 2001
Posts: 8964
    
    9

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.


[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable is not getting refreshed.