*
The moose likes Swing / AWT / SWT and the fly likes defaultMutableTreeNode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "defaultMutableTreeNode" Watch "defaultMutableTreeNode" New topic
Author

defaultMutableTreeNode

Bo Ling
Greenhorn

Joined: Oct 27, 2003
Posts: 5
I use DefaultMutableTreeNode to build tree. How do I change the Node name (just the name is changed, the tree structure remains the same) after building the tree.
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
It's been a while since I've done JTree stuff, but as I remember it, you use the setUserObject method, passing in an object which will set the caption by caling the toString method on the object. In most cases, I would imagine you would pass a string to setUserObject, or at least an object whose toString method is overridden to provide a useful caption to the tree nodes.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: defaultMutableTreeNode
 
Similar Threads
How to work with t:tree component
JTree ------odd thing
how to add Jtree object in JInternal frame?
Parsing a TreeModel structure
disabling the view of files in Jtree