• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

JTable Updating

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> 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
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Sheriff
Posts: 22895
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We don't want full code files, we want SSCCEs.
 
Marshal
Posts: 28492
113
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic