JTree, open up a specified path, how?

I have struggled a while with a JTree problem.

path=tree.getSelectionPath();

//other code

tree.setSelectionPath(path);

The get returns what I expect.

Then, at a later moment I want to use set.

My problem then is that I want the path to be visible in the tree structure.

How can I acheive this?

Message was edited by:

sandsater

[419 byte] By [sandsatera] at [2007-10-3 3:11:19]
# 1
Hi,I'm not sure if I undestand where your problem is. If you want to expand the path to the node (so the node is visible on the screen), you can use public void expandPath(TreePath path) method.L.P.
lukika at 2007-7-14 21:02:10 > top of Java-index,Desktop,Core GUI APIs...
# 2

I tried that now but it didn磘 work ;(

It worked 'half' after I also added updateUI();

It only expands half way down the hierarchy.

Could it be because of it isn't the 'same' tree when I expand? It is almost the same tree but with a node added or deleted but it is created from scratch again.

Message was edited by:

sandsater

sandsatera at 2007-7-14 21:02:10 > top of Java-index,Desktop,Core GUI APIs...