Solved

JTree Help

Posted on 2004-09-02
8
305 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
Industry Leaders: 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!

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

623 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