File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTree node selection

 
Vijay Krishna
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can u give me the code how to generate tree
 
Pat Hays
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Super Dev

Here is the code.
 
Vijay Krishna
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Finally I got a solution.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic