Class DragSourceDropEvent
java.lang.Object
java.util.EventObject
java.awt.dnd.DragSourceEvent
java.awt.dnd.DragSourceDropEvent
- All Implemented Interfaces:
Serializable
The
DragSourceDropEvent is delivered
from the DragSourceContextPeer,
via the DragSourceContext, to the dragDropEnd
method of DragSourceListeners registered with that
DragSourceContext and with its associated
DragSource.
It contains sufficient information for the
originator of the operation
to provide appropriate feedback to the end user
when the operation completes.- Since:
- 1.2
- See Also:
-
Field Summary
Fields declared in class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionConstruct aDragSourceDropEventfor a drag that does not result in a drop.DragSourceDropEvent(DragSourceContext dsc, int action, boolean success) Construct aDragSourceDropEventfor a drop, given theDragSourceContext, the drop action, and abooleanindicating if the drop was successful.DragSourceDropEvent(DragSourceContext dsc, int action, boolean success, int x, int y) Construct aDragSourceDropEventfor a drop, given theDragSourceContext, the drop action, abooleanindicating if the drop was successful, and coordinates. -
Method Summary
Modifier and TypeMethodDescriptionintThis method returns anintrepresenting the action performed by the target on the subject of the drop.booleanThis method returns abooleanindicating if the drop was successful.Methods declared in class DragSourceEvent
getDragSourceContext, getLocation, getX, getYModifier and TypeMethodDescriptionThis method returns theDragSourceContextthat originated the event.This method returns aPointindicating the cursor location in screen coordinates at the moment this event occurred, ornullif the cursor location is not specified for this event.intgetX()This method returns the horizontal coordinate of the cursor location in screen coordinates at the moment this event occurred, or zero if the cursor location is not specified for this event.intgetY()This method returns the vertical coordinate of the cursor location in screen coordinates at the moment this event occurred, or zero if the cursor location is not specified for this event.Methods declared in class EventObject
getSource, toStringMethods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
DragSourceDropEvent
Construct aDragSourceDropEventfor a drop, given theDragSourceContext, the drop action, and abooleanindicating if the drop was successful. The coordinates for thisDragSourceDropEventare not specified, sogetLocationwill returnnullfor this event.The argument
actionshould be one ofDnDConstantsthat represents a single action. This constructor does not throw any exception for invalidaction.- Parameters:
dsc- theDragSourceContextassociated with thisDragSourceDropEventaction- the drop actionsuccess- a boolean indicating if the drop was successful- Throws:
IllegalArgumentException- ifdscisnull.- See Also:
-
DragSourceDropEvent
Construct aDragSourceDropEventfor a drop, given theDragSourceContext, the drop action, abooleanindicating if the drop was successful, and coordinates.The argument
actionshould be one ofDnDConstantsthat represents a single action. This constructor does not throw any exception for invalidaction.- Parameters:
dsc- theDragSourceContextassociated with thisDragSourceDropEventaction- the drop actionsuccess- a boolean indicating if the drop was successfulx- the horizontal coordinate for the cursor locationy- the vertical coordinate for the cursor location- Throws:
IllegalArgumentException- ifdscisnull.- Since:
- 1.4
-
DragSourceDropEvent
Construct aDragSourceDropEventfor a drag that does not result in a drop. The coordinates for thisDragSourceDropEventare not specified, sogetLocationwill returnnullfor this event.- Parameters:
dsc- theDragSourceContext- Throws:
IllegalArgumentException- ifdscisnull.- See Also:
-
-
Method Details
-
getDropSuccess
public boolean getDropSuccess()This method returns abooleanindicating if the drop was successful.- Returns:
trueif the drop target accepted the drop and successfully performed a drop action;falseif the drop target rejected the drop or if the drop target accepted the drop, but failed to perform a drop action.
-
getDropAction
public int getDropAction()This method returns anintrepresenting the action performed by the target on the subject of the drop.- Returns:
- the action performed by the target on the subject of the drop
if the drop target accepted the drop and the target drop action
is supported by the drag source; otherwise,
DnDConstants.ACTION_NONE.
-