• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How to refresh my tree when the model changes.

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have written my own custom tree model. I create the JTree and pass the model as parameter then show the JTree in a scrollpane.
There is a button to repopulate the tree model. My question is when I hit this the model is repopulated, but the UI does not reflect the changes even after calling revalidate.
What is the best way to detect the changes and update the JTree/UI properly when the whole tree model (except the root node) is regenerated? Should I be firing some sort of event from the tree model after it's regenerated or something?
Thanks for the assistance.
Rich.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Richard,
At what point in your code are you calling the validate( ) method? Also, which components validate( ) method are you calling?
Maybe post a little code in a reply so we can see what you're doing easier.
Cheers,
Andy.
"I Code, Therefore I Am"
 
Richard Johnson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay sure, this will be very trimmed down from the actual code. The abstract view is just a fancy JPanel that does various other interesting things I use in my application framework, I just call revalidate on it:
 
reply
    Bookmark Topic Watch Topic
  • New Topic