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

Refresh JTable

Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Here is the code.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18136
    
    8

I don't see any JTable in that example code. But that doesn't matter... the easiest way to change all the data in a JTable is to create a new instance of the table model and pass that to the JTable via its setModel() method.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Hasn't anybody ever told you to UseCodeTags before?

Anyway, you don't need to replace the JTable. You only need to replace the JTable's TableModel. Create a new one, and call setModel on the JTable.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
thanks! could you post an example pelase?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18136
    
    8

Example based on code from your original post:
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Thank you very much!
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Thank you! The code below works very well.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refresh JTable
 
Similar Threads
Wanted: Advise on threads and application layout
Problem adding JComboBox to JFrame
JComboBox stores same
JTable action listener
GUI Access Problems