Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to refresh my tree when the model changes.

 
Richard Johnson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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.
 
Andy Nimmo
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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
  • 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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic