java.awt.dnd.InvalidDnDOperationException: No drop current

O

Ottfried

Following situation:
I designed an own component A inherit from JPanel and implementing
DragSourceListener, DropTargetListener and DragGestureListener. Second
I wrote a class, say ATransferable, implementing Transferable. This
class defines a custom DataFlavor as a public static field, AFLAVOR.
The goal is to transfer data by Drag & Drop from one instance of A to
another instance (in a different VM) of A. Until now it is possible do
DnD A into itself (i.e. into the same instance). This works fine. But
trying to DnD it into another instance the exception
"java.awt.dnd.InvalidDnDOperationException: No drop current" appears
for event.getTransferable().getTransferData(AFLAVOR), where event is
of type DropTargetDropEvent. Despite that
event.getTransferable().getTransferDataFlavors() returns AFLAVOR.

Comparing the former and the latter case, I found out, that in the
latter case event.getTransferable() returns a Transferable, where the
contained field (Transferable) local is null.

What goes wrong? Did I forget anything? Have I create my own
TransferHandler? Can anyone explain what steps I've left out to do?

Thanks!

Ottfried
 
O

Ottfried

Following situation:
I designed an own component A inherit from JPanel and implementing
DragSourceListener, DropTargetListener and DragGestureListener. Second
I wrote a class, say ATransferable, implementing Transferable. This
class defines a custom DataFlavor as a public static field, AFLAVOR.
The goal is to transfer data by Drag & Drop from one instance of A to
another instance (in a different VM) of A. Until now it is possible do
DnD A into itself (i.e. into the same instance). This works fine. But
trying to DnD it into another instance the exception
"java.awt.dnd.InvalidDnDOperationException: No drop current" appears
for event.getTransferable().getTransferData(AFLAVOR), where event is
of type DropTargetDropEvent. Despite that
event.getTransferable().getTransferDataFlavors() returns AFLAVOR.

There is an easy answer: the drop is available not before
event.acceptDrop(...). This means the drop can't be used to check the
admissibilty of the drop action!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top