FileDocCategorySizeDatePackage
DragSourceDropEvent.javaAPI DocJava SE 5 API5077Fri Aug 26 14:56:48 BST 2005java.awt.dnd

DragSourceDropEvent

public class DragSourceDropEvent extends DragSourceEvent
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.

version
1.19, 12/19/03

since
1.2

Fields Summary
private static final long
serialVersionUID
private boolean
dropSuccess
true if the drop was successful.
private int
dropAction
The drop action.
Constructors Summary
public DragSourceDropEvent(DragSourceContext dsc, int action, boolean success)
Construct a DragSourceDropEvent for a drop, given the DragSourceContext, the drop action, and a boolean indicating if the drop was successful. The coordinates for this DragSourceDropEvent are not specified, so getLocation will return null for this event.

The argument action should be one of DnDConstants that represents a single action. This constructor does not throw any exception for invalid action.

param
dsc the DragSourceContext associated with this DragSourceDropEvent
param
action the drop action
param
success a boolean indicating if the drop was successful
throws
IllegalArgumentException if dsc is null.
see
DragSourceEvent#getLocation


                                                                                                            

           
	super(dsc);

	dropSuccess = success;
	dropAction  = action;
    
public DragSourceDropEvent(DragSourceContext dsc, int action, boolean success, int x, int y)
Construct a DragSourceDropEvent for a drop, given the DragSourceContext, the drop action, a boolean indicating if the drop was successful, and coordinates.

The argument action should be one of DnDConstants that represents a single action. This constructor does not throw any exception for invalid action.

param
dsc the DragSourceContext associated with this DragSourceDropEvent
param
action the drop action
param
success a boolean indicating if the drop was successful
param
x the horizontal coordinate for the cursor location
param
y the vertical coordinate for the cursor location
throws
IllegalArgumentException if dsc is null.
since
1.4

        super(dsc, x, y);

        dropSuccess = success;
        dropAction  = action;
    
public DragSourceDropEvent(DragSourceContext dsc)
Construct a DragSourceDropEvent for a drag that does not result in a drop. The coordinates for this DragSourceDropEvent are not specified, so getLocation will return null for this event.

param
dsc the DragSourceContext
throws
IllegalArgumentException if dsc is null.
see
DragSourceEvent#getLocation

	super(dsc);

	dropSuccess = false;
    
Methods Summary
public intgetDropAction()
This method returns an int representing the action performed by the target on the subject of the drop.

return
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.

 return dropAction; 
public booleangetDropSuccess()
This method returns a boolean indicating if the drop was successful.

return
true if the drop target accepted the drop and successfully performed a drop action; false if the drop target rejected the drop or if the drop target accepted the drop, but failed to perform a drop action.

 return dropSuccess;