Data Transfer

The DropTargetListener's drop method is responsible for the data transfer. There are three parts to the drop method:

  • Checks validity of the dropped action and DataFlavor; the drop is rejected, if necessary.

  • Accepts the drop with a specified action and the Transferable's data object is retrieved.

  • Reads and uses the data.

Drop Method Part 1: Validation

The DropTargetListener chooses the DataFlavor and checks the operation before the transfer takes place. The DropTargetListener sends a rejectDrop message to the DropTargetDropEvent if none of the DataFlavors and/or operations is acceptable. The Event object may be queried with isLocalTransfer if the drag source is in the same JVM. If this is so, the DropTargetListener can choose an appropriate ...

Get JavaBeans Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.