• Post Reply Bookmark Topic Watch Topic
  • New Topic

Better ways to refresh a Tree  RSS feed

 
Ravi Sathish
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers

I have a tree...with Tree Model and Tree Selection Modela nd their respective Listeners.

Currently only way I can successfully refresh a Tree is via the call
tree.updateUI()

Unfortunately this call can be made only within a event handler... { I'm not sure whether my assumption is valid } but whenever I make the call outside an event handler I get a null pointer exception... without the call my Tree is not properly refreshed...

How do you guys refresh the trees ?

Please advice

Ravi
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you make a call outside an event handler you can use SwingUtilities.invokeLater .
Somthing like this:


or you cane use method reload() or reload(TreeNode node) from DefaultTreeModel class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!