File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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

I agree. Here's the link:
subject: JTree expansion
It's not a secret anymore!