This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable Updating Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable Updating" Watch "JTable Updating" New topic
Author

JTable Updating

Maya Naga
Ranch Hand

Joined: Nov 09, 2009
Posts: 79
hi ranches,

i developed a program to display the files in selected directories or folders using jtree and jtable..
i have a jdialog which gets the folder from the user..
i have no problem while choosing the folder for first time..
but when i again choose another folder the new files get append with the last displayed files...
i have tried lots of methods to refresh the jtable when the user selects the open dialog ..........

here is my code:
// this is for opening the jdialog:


//this s for showing the files list in jtable and jtree



code for jtree


my own table model code




need help...
thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> need help...
> thanks

if you really want help, you'd post something we can copy/paste/compile/run and see what you see.

if you just want us to read your snippets, well, I'd prefer to go to the library
Maya Naga
Ranch Hand

Joined: Nov 09, 2009
Posts: 79
this time i will enter my entire data



problem am getting is when we choose new directory or folder, the files in selected folder get append with the jtable value ...

i have tried few methods to do it such as fireTableDataChanged etc. but nothing happened..
what i should do to refresh jtable every time while user chooses new folder/directory?...
thanks..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

We don't want full code files, we want SSCCEs.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Ambika Nagalakshmi wrote:what i should do to refresh jtable every time while user chooses new folder/directory?

Create a new instance of your table model, put your data into it, and call the JTable's setModel method.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTable Updating
 
Similar Threads
JTree
JCheckBox in Jtree Problem
Help JTree is not displaying inside of JFrame
DND from JTree to JTable
JTable In JTree