This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Show expanded JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Show expanded JTree" Watch "Show expanded JTree" New topic
Author

Show expanded JTree

Ezra Exposito
Ranch Hand

Joined: Apr 26, 2001
Posts: 34
By default a JTree is displayed with only the root node
expanded. I would like to display the tree completely
expanded from the start since the most important information
in my app are at the leaf nodes. Any ideas or links to good
resources would be greatly appreciated.
Thanks
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Ezra,
As a quick and dirty approach I would do the following:

Regards,
Manfred.
Ezra Exposito
Ranch Hand

Joined: Apr 26, 2001
Posts: 34
Thanks a bunch, my tree is now fully expanded when it starts.
One last question:
Within a folder the default is to display the subfolders first and then any leaves. Is it possible to reverse the order so that
the leaves are first and then the folders ?
Thanks.
 
 
subject: Show expanded JTree