Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Identify the path of the node and insert in JTree.

 
Melki Joe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having two trees and I want to get the node from one tree and insert it into another tree. While inserting if the source node has more parents how to identify the path of the node and insert into the appropriate node in the destination tree.

Kindly help me in this issue.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you want to indicate what node to copy and where to move it to? What does "more parents" mean? That the node is more than 1 layer deep in the tree? Why does this matter? Are you trying to copy the node itself or the node and the path to it? Or do you need to insert the node at the same level in the new location?
 
Melki Joe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to insert the node at the same level in the new location.

Here I am giving the structure for more parents.

A
-1
--2
---leaf1
---leaf2
B
-1
--2
---leaf1
---leaf2
---leaf3

I want to transfer the leaf nodes as if the left tree to the right tree.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic