Hi all!
Maybe this is very simple, but I am struggling to get the root node of a
JTree if nothing is selected in the tree. On my JTree object, I invoke could
invoke:
((DefaultTreeModel)bookmarkTree.getSelectionModel()).getRoot();
This delivers the user object, but I need the root node as
DefaultMutableTreeNode, not as user object. How can I achieve this?
Thanks
Ulrich
Thomas Weidenfeller - 20 Apr 2004 09:15 GMT
> Hi all!
> Maybe this is very simple, but I am struggling to get the root node of a
> JTree if nothing is selected in the tree. On my JTree object, I invoke could
> invoke:
>
> ((DefaultTreeModel)bookmarkTree.getSelectionModel()).getRoot();
jtree.getModel().getRoot();
/Thomas
Ulrich Rueth - 20 Apr 2004 13:56 GMT
> > Hi all!
> > Maybe this is very simple, but I am struggling to get the root node of a
[quoted text clipped - 6 lines]
>
> /Thomas
Thomas, this returns (as stated in my original post) the user object,
but I need the DefaultMutableTreeNode object! So your solution is
exactly my problem :-(
Thanks®ards
Ulrich
Thomas Weidenfeller - 20 Apr 2004 14:27 GMT
> Thomas, this returns (as stated in my original post) the user object,
Repeating that statement doesn't make it true.
/Thomas
Ulrich Rueth - 20 Apr 2004 17:43 GMT
Convinced! Thank you!!!
> > Thomas, this returns (as stated in my original post) the user object,
>
> Repeating that statement doesn't make it true.
>
> /Thomas