Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2004

Tip: Looking for answers? Try searching our database.

Select JTree root node

Thread view: 
Ulrich Rueth - 19 Apr 2004 21:12 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();

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&regards
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.