Originally Posted by
copeg
Any reason why you can't just create a wrapper class which wraps the Object of interest and returns the appropriate String value for the JTree, then add these to the JTree?
I can't think of any reason. But isn't DefaultMutableTreeNode just such a wrapper?... As discussed above.
Its toString() returns the toString() of the wrapped object for display in a simple tree, behaviour which can be overridden (at the time the object is added to the tree, thereby removing the need for any nasty "instanceof" later.)