站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Interface DropTargetListener - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

java.awt.dnd
Interface DropTargetListener

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:
JDK1.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
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.