Solved

JTree Help

Posted on 2004-09-02
8
288 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
javap bin 2 41
Windows 10 IE Certificate Issue 10 51
eclipse buid path vs tomcat lib path 10 34
Problem to Alipay 10 48
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

808 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