Use the JTree.getPathForLocation(int x, int y) to figure it out.
----- Original Message -----
From: "Brian Engel" <BEngel@xxxxxxxxxxxxx>
To: <users@xxxxxxxxxx>
Sent: Thursday, June 19, 2003 9:06 AM
Subject: [cinjug-users] JTree and DND
I am trying to create a JTree which I can drag and drop one
DefaultMutableTreeNode on top of another (with hopes of actually moving it
there).
I have figured out how to create a class that implements DropTargetListener
and I can successfully "capture" events that JTree fires. What I want to
know is there a way to figure out what object (DefaultMutableTreeNode, in
this case) has been dropped on top of?
i.e. I have a simple JTree like this....
Root
|
―--Child1
| |----GrandChild1
|---Child2
I want to drag GrandChild1 and drop it on top of Root. I need to figure out
(through the listener I suppose) what object was dropped on top of what.
Primarily so I can rebuild the tree with GrandChild1 as a Child of Root.
Do this make any sense :-) ?
Any help would be appreciated.....
|