JTree Help

I would to cascade a tree Node using JTree like below.


Root(r)+
|                                    1.c]
|                                 1.b]
|-------------------[Node1.a]
|
|                                    2.c]
|                                   2.b]
|______________[Node 2.a]
|
|
|
|


When Node 1.b has got focus and selected the tree structure will be


Root(r)+
|                                    1.c]
|                                 1.a]
|-------------------[Node1.b]
|
|                                    2.c]
|                                   2.b]
|______________[Node 2.a]
|
|
|
|


How could  i do using JTree Component?
ammachiyarAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
If I follow you correctly you would need to change the structure of the tree whenever a node is selected.
can you explain more about what u are trying to achieve?
0
 
armoghanCommented:
You are just swaping the two nodes?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
armoghanConnect With a Mentor Commented:
get to the path of the Tree nodes using TreePath and swap the userObject of the two nodes
0
 
Giant2Connect With a Mentor Commented:
>get to the path of the Tree nodes using TreePath and swap the userObject of the two nodes

...and fire the action to the Tree
0
 
girionisConnect With a Mentor Commented:
Just changing the name of the node would be fine (I think).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.