cancel
Showing results for 
Search instead for 
Did you mean: 

Show expanded tree

Former Member
0 Kudos

Hello everyone,

I seem to have a slight problem with showing a tree expanded. Basically what happens is when I open the panel the node i want selected seems to have actually been selected ( subclass.tree.setSelectionPath(path) ) but the tree isn't 'shown' at that expanded state meaning i can not see it's opened to that node i only know it is cause of the data shown in a table (different data is shown depending on the node selected) i can expand the tree manually but in this case I want the tree to come up directly in that state.

could anyone give me a clue as to how i should go around this please?

i use subclass.tree.expandPath(path) and tree.expandPath(path) and i've tried calling tree.fireTreeExpanded(path) and of course tree.makeVisible(path) or subclass.tree.makeVisible(path) but nothing seems to work

thanks in advance for the help, i just can't seem to get my head around it

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186016
Active Contributor
0 Kudos

Hi Alex,

Is this Swing, AWT, SWT or webdynpro ?

Regards,

Ashwani

Former Member
0 Kudos

thanks for your reply,

it's javax.swing.JTree

I don't know i just can't get it to visually expand the tree to that state although from the path i managed to set the node i want selected and that works ok as i've mentioned above.

thanks again for your efforts

Alex

former_member186016
Active Contributor
0 Kudos

Hi Alex,

Please check following URL:

<a href="http://www.codeguru.com/java/articles/189.shtml">Link</a>

Hope it helps :

Regards,

Ashwani

Former Member
0 Kudos

Hi Ashwani thanks for your reply,

unfortunately the selected node is not a problem (from what i can see) the path i've got seems to be correct (i print it out and check it several times in the code) and the data which should be displayed when the node is selected is displayed, the problem is that the tree is not expanded so that specific node is visible and i don't understand why since i tell it to expand to that specific path again.

Also (I don't know if this will help) but after i've called: <b>tree.expandPath(path)</b>

when I call <b>tree.isExpanded(path)</b> the result is <b>false</b> and I don't understand why it won't expand the tree to that path especially since the selection works.

I apreciate the help,

thanks agian for trying i'm open to all ideas you've got

Message was edited by:

Alex Stamatopoulos