JavaTM 2 Platform
Std. Ed. v1.3.1

java.awt.dnd
Interface DropTargetListener

All Superinterfaces:
EventListener
All Known Implementing Classes:
DropTarget

public interface DropTargetListener
extends EventListener

The DropTargetListener interface is the callback interface used by the DropTarget class to provide notification of DnD operations that involve the subject DropTarget. Methods of this interface may be implemented to provide "drag under" visual feedback to the user throughout the Drag and Drop operation.

Since:
1.2

Method Summary
 void dragEnter(DropTargetDragEvent dtde)
          Called when a drag operation has encountered the DropTarget.
 void dragExit(DropTargetEvent dte)
          The drag operation has departed the DropTarget without dropping.
 void dragOver(DropTargetDragEvent dtde)
          Called when a drag operation is ongoing on the DropTarget.
 void drop(DropTargetDropEvent dtde)
          The drag operation has terminated with a drop on this DropTarget.
 void dropActionChanged(DropTargetDragEvent dtde)
          Called if the user has modified the current drop gesture.
 

Method Detail

dragEnter

public void dragEnter(DropTargetDragEvent dtde)
Called when a drag operation has encountered the DropTarget.

Parameters:
dtde - the DropTargetDragEvent

dragOver

public void dragOver(DropTargetDragEvent dtde)
Called when a drag operation is ongoing on the DropTarget.

Parameters:
dtde - the DropTargetDragEvent

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dtde)
Called if the user has modified the current drop gesture.

Parameters:
dtde - the DropTargetDragEvent

dragExit

public void dragExit(DropTargetEvent dte)
The drag operation has departed the DropTarget without dropping.

Parameters:
dte - the DropTargetEvent

drop

public void drop(DropTargetDropEvent dtde)
The drag operation has terminated with a drop on this DropTarget. This method is responsible for undertaking the transfer of the data associated with the gesture. The DropTargetDropEvent provides a means to obtain a Transferable object that represents the data object(s) to be transfered.

From this method, the DropTargetListener shall accept or reject the drop via the acceptDrop(int dropAction) or rejectDrop() methods of the DropTargetDropEvent parameter.

Subsequent to acceptDrop(), but not before, DropTargetDropEvent's getTransferable() method may be invoked, and data transfer may be performed via the returned Transferable's getTransferData() method.

At the completion of a drop, an implementation of this method is required to signal the success/failure of the drop by passing an appropriate boolean to the DropTargetDropEvent's dropComplete(boolean success) method.

Note: The actual processing of the data transfer is not required to finish before this method returns. It may be deferred until later.

Parameters:
dtde - the DropTargetDropEvent

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.