This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree node  selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree node  selection" Watch "JTree node  selection" New topic
Author

JTree node selection

Vijay Krishna
Greenhorn

Joined: Feb 10, 2005
Posts: 9
Hi

I hav two JTrees displayed side by side. These two trees have almost similar structure.My requirement is , when user selects a node from one tree, corresponding node in the second tree should be shown as selected automatically. Is there anyway?

Thanks in advance,
Dev.
pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
Can u give me the code how to generate tree


Regards,
Pankaj Patil
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
Hello Super Dev

Here is the code.


Download Java GUI Builder, <a href="http://www.mars3000.com" target="_blank" rel="nofollow">http://www.mars3000.com</a>
Vijay Krishna
Greenhorn

Joined: Feb 10, 2005
Posts: 9
Hi Pat Hays..

Thanks for ur replay..
My problem was how to find the corresponding node in the second tree.

DefaultMutableTreeNode correspondingNode = ???; // how to get this
matching node.

User can select any inner node , and I want to find that corresponding node in the second tree.
Vijay Krishna
Greenhorn

Joined: Feb 10, 2005
Posts: 9
Hi..

Finally I got a solution.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Super Dev,

We don't have too many rules around here but we do have a Naming Policy. Member names must appear to be a real name. Please adjust your display name accordingly. You can do so by clicking on the My Profile link towards the top of the page.

Thanks and welcome to Javaranch!


GenRocket - A Test Data Generation Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree node selection
 
Similar Threads
Identify the path of the node and insert in JTree.
Adding tree node to same root ..?
recursion backwards?
Richfaces navigation problem: selecting a tree node from content area
how to split a number into two multipliyers