This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree expansion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree expansion" Watch "JTree expansion" New topic

JTree expansion


Joined: Sep 21, 2001
Posts: 17
My tree is coming collapsed when i run my application, i have tried using functions like expandRow(int), setExpandedState(Treepath, boolean), but it doesn't work.
Also if i use setExpandedState(Treepath, boolean) function, then in collapsed state Treepath argument will be null, so there is no point in using it.
please help me!!
thanks in advance.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
HI Nikhil,
Not sure what you have tried. The example below works great. To run it just type:
java ExpandDemo
To run it and have all folders expanded type:
java ExpandDemo true

subject: JTree expansion
Similar Threads
JTree - keeping expanded nodes expanded after deleting a node
Searching a JTree
Initially expanded JTree?
Edit Values in a JTree
JTree doesn't return expected value when calling tree.isVisible(treePath)