• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

update treenode's parent in jtree

 
mark goking
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
mark goking
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, never mind. ;)

i just had to pass the root treenode in nodeChanged() to update all nodes.
 
santhosh varala kumar
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic