Mouse position while drag&drop-operation  
Author Message
mic





PostPosted: 2006-12-14 0:41:00 Top

java-programmer, Mouse position while drag&drop-operation Hi swing experts!

I have the following problem:

I want to move a custom Transferable via Drag&Drop from a JTree to a
JPanel.
The transferable should be shown on the JPanel on the position the
mouse is released.

The trouble is, I can't determine the mouse position on the JPanel.
The mouseListener and mouseMotionListener-routines on the JPanel
obviously don't work while in a standard-java-drag&drop operation.
For example: The JPanel doesn't fire a mouseEntered(..)-Event, when the
panel is entered during a drag&drop-operation.

So, without Mouse-Events, how do I get the drop-coordinates relative to
the JPanel?

Any clues?
Thanks in advance! Your help is very appreciated.

Best,
Michael

 
Andrew Thompson





PostPosted: 2006-12-14 1:50:00 Top

java-programmer >> Mouse position while drag&drop-operation mic wrote:
> Hi swing experts!

Note that D'n'D is AWT.

> I want to move a custom Transferable via Drag&Drop from a JTree to a
> JPanel.
...
> The trouble is, I can't determine the mouse position on the JPanel.

<url:http://java.sun.com/j2se/1.5.0/docs/api/java/awt/dnd/DragSourceEvent.html#getLocation()>

Andrew T.

 
mic





PostPosted: 2006-12-14 4:30:00 Top

java-programmer >> Mouse position while drag&drop-operation Thanks for pointing me to the right direction... got it working.

cheers,
michael


Andrew Thompson schrieb:

> mic wrote:
> > Hi swing experts!
>
> Note that D'n'D is AWT.
>
> > I want to move a custom Transferable via Drag&Drop from a JTree to a
> > JPanel.
> ...
> > The trouble is, I can't determine the mouse position on the JPanel.
>
> <url:http://java.sun.com/j2se/1.5.0/docs/api/java/awt/dnd/DragSourceEvent.html#getLocation()>
>
> Andrew T.