wood burning stoves*
The moose likes Java in General and the fly likes JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JTree" Watch "JTree" New topic
Author

JTree

joe jean
Greenhorn

Joined: Sep 05, 2006
Posts: 6
I am using DefaultMutableTreeNode. I set the object for the node using
setUserObject , but I need to concatenate strings to the node and display the concatenated value for the object.

Is there a way to do this , instead of having to override the toString method.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Overriding the toString() method of the object you put into the tree node is certainly the most natural way to do that, and I can't really see why you would not want to do it. But if there is some reason why not, you could probably have your TreeCellRenderer set some different text.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree
 
Similar Threads
ParserImpl for DOM
LINK LIST IN JAVA WITHOUT COLLECTION FRAMEWORK
JTable inside a Graphics Rectangle
JAXP-DOM Node Import Issue
Binary Search Tree