Solved

JTree Help

Posted on 2004-09-02
8
301 Views
Last Modified: 2010-03-31
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?
0
Comment
Question by:ammachiyar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 92

Accepted Solution

by:
objects earned 25 total points
ID: 11970637
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
 
LVL 18

Expert Comment

by:armoghan
ID: 11970640
You are just swaping the two nodes?
0
 
LVL 6

Assisted Solution

by:expertmb
expertmb earned 25 total points
ID: 11970641
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 18

Assisted Solution

by:armoghan
armoghan earned 25 total points
ID: 11970643
get to the path of the Tree nodes using TreePath and swap the userObject of the two nodes
0
 
LVL 12

Assisted Solution

by:Giant2
Giant2 earned 25 total points
ID: 11970693
>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
 
LVL 35

Assisted Solution

by:girionis
girionis earned 25 total points
ID: 11970761
Just changing the name of the node would be fine (I think).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question