File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 15300
    
    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 - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree node selection