• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to repaint or refresh a jtree

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to repaint or refresh a jtree so that changes can take effect ?
i have tried this methods repaint , revalidate but failed to achieve this
can any one help me ?
 
Paul Clapham
Sheriff
Posts: 21867
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't even need to do that. If you're using a DefaultTreeModel then you just call one of the methods with names like "nodeChanged" or "nodesWereInserted" when you change a node or insert some nodes or make any other change to the content or structure of the tree.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul +1

The best way to learn how to use a Swing component, is to refer to it's API. Not only is it very well documented, but it also provides useful examples like how to use trees which in turn shows you how to dynamically change the tree contents.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!