Programatically expanding a JTree
0 posts in topic
Thread View Thread View
TOPIC ACTIONS:
 

Programatically expanding a JTree...
ni4ni
Sun Jun 24, 2012 06:19 AM

Hello

I have a JTree on a ScrollPane with multiple nodes and sub-nodes. The user can choose any of them directly.
Besides this I have a list of recently accessed nodes, when the user selects an entry from the list, the tree should expand the path to this node and select it.

I store a path for every node of the tree in a separate database so when a user selects an entry from the list I can immediately have its tree path. Then I use scrollPathToVisible(treepath) but it does not expand the tree.
I also tried expandPath(treepath) or even a combination of both but the tree does not expand at all.

What am I doing wrong ? whats the preferred method to programatically expand a tree path ?

Thanks

Guy
About | Sitemap | Contact