permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes update treenode's parent in jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "update treenode Watch "update treenode New topic
Author

update treenode's parent in jtree

mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
hi. i have no problems calling nodeChanged() for the child node. my problem is how have the parentnodes update themselves?

calling nodeChanged like nodeChanged(dmtn.getParent()) where dmtn is a DefaultMutableTreeNode messes up my JTree. any ideas?


Website/Java Games: http://www.chitgoks.com
Tech Blog: http://tech.chitgoks.com
mark goking
Ranch Hand

Joined: Aug 18, 2009
Posts: 155
well, never mind. ;)

i just had to pass the root treenode in nodeChanged() to update all nodes.
santhosh varala kumar
Greenhorn

Joined: Nov 05, 2009
Posts: 25
mark chester goking wrote:well, never mind. ;)

i just had to pass the root treenode in nodeChanged() to update all nodes.


If you are using DefaultMutableTreeNode, you can update by calling setUserObject on that node. and call repaint/revalidate on tree.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: update treenode's parent in jtree