Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTree node selection

 
Vijay Krishna
Greenhorn
Posts: 9
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Super Dev

Here is the code.
 
Vijay Krishna
Greenhorn
Posts: 9
  • 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
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic