DropTargetDragEvent is delivered to a
DropTargetListener via its
dragEnter() and dragOver() methods.
The DropTargetDragEvent reports the source drop actions
and the user drop action that reflect the current state of
the drag operation.
Source drop actions is a bitwise mask of DnDConstants
that represents the set of drop actions supported by the drag source for
this drag operation.
User drop action depends on the drop actions supported by the drag source and the drop action selected by the user. The user can select a drop action by pressing modifier keys during the drag operation:
Ctrl + Shift -> ACTION_LINK Ctrl -> ACTION_COPY Shift -> ACTION_MOVEIf the user selects a drop action, the user drop action is one of
DnDConstants that represents the selected drop action if this
drop action is supported by the drag source or
DnDConstants.ACTION_NONE if this drop action is not supported
by the drag source.
If the user doesn't select a drop action, the set of
DnDConstants that represents the set of drop actions supported
by the drag source is searched for DnDConstants.ACTION_MOVE,
then for DnDConstants.ACTION_COPY, then for
DnDConstants.ACTION_LINK and the user drop action is the
first constant found. If no constant is found the user drop action
is DnDConstants.ACTION_NONE.
| Modifier and Type | Field and Description |
|---|---|
| private int | actions
The source drop actions. |
| private int | dropAction
The user drop action. |
| private Point | location
The location of the drag cursor's hotspot in Component coordinates. |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.4 for interoperability.
|
| Access | Constructor and Description |
|---|---|
| public | DropTargetDragEvent(DropTargetContext
The DropTargetContext for this operation dtc, Point The location of the "Drag" Cursor's
hotspot in Component coordinates cursorLocn, int The user drop action dropAction, int The source drop actions srcActions)Construct a |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public DataFlavor[] | Returns: current DataFlavors from the DropTargetContextThis method returns the current |
| public List | Returns: ajava.util.List of the Current DataFlavorsThis method returns the current |
| public int | |
| public Point | Returns: the current cursor location inComponent's coords.This method returns a |
| public int | |
| public Transferable | Returns: the Transferable associated with the drag operationThis method returns the Transferable object that represents the data associated with the current drag operation. |
| public boolean | Returns: true if a particular DataFlavor is supported,
otherwise falsethe df)DataFlavor to testThis method returns a |
| public void | rejectDrag()
Rejects the drag as a result of examining either the
|
| actions | back to summary |
|---|---|
| private int actions The source drop actions. | |
| dropAction | back to summary |
|---|---|
| private int dropAction The user drop action. | |
| location | back to summary |
|---|---|
| private Point location The location of the drag cursor's hotspot in Component coordinates. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.4 for interoperability. | |
| DropTargetDragEvent | back to summary |
|---|---|
| public DropTargetDragEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions) Construct a
| |
| acceptDrag | back to summary |
|---|---|
| public void acceptDrag(int dragOperation) Accepts the drag.
This method should be called from a
| |
| getCurrentDataFlavors | back to summary |
|---|---|
| public DataFlavor[] getCurrentDataFlavors() This method returns the current
| |
| getCurrentDataFlavorsAsList | back to summary |
|---|---|
| public List This method returns the current
| |
| getDropAction | back to summary |
|---|---|
| public int getDropAction() This method returns the user drop action.
| |
| getLocation | back to summary |
|---|---|
| public Point getLocation() This method returns a
| |
| getSourceActions | back to summary |
|---|---|
| public int getSourceActions() This method returns the source drop actions.
| |
| getTransferable | back to summary |
|---|---|
| public Transferable getTransferable() This method returns the Transferable object that represents the data associated with the current drag operation.
| |
| isDataFlavorSupported | back to summary |
|---|---|
| public boolean isDataFlavorSupported(DataFlavor df) This method returns a
| |
| rejectDrag | back to summary |
|---|---|
| public void rejectDrag() Rejects the drag as a result of examining either the
| |