- java.lang.Object
- 
- java.util.EventObject
- 
- java.awt.dnd.DragSourceEvent
- 
- java.awt.dnd.DragSourceDragEvent
 
 
 
- 
- All Implemented Interfaces:
- Serializable
 
 public class DragSourceDragEvent extends DragSourceEvent TheDragSourceDragEventis delivered from theDragSourceContextPeer, via theDragSourceContext, to theDragSourceListenerregistered with thatDragSourceContextand with its associatedDragSource.The DragSourceDragEventreports the target drop action and the user drop action that reflect the current state of the drag operation.Target drop action is one of DnDConstantsthat represents the drop action selected by the current drop target if this drop action is supported by the drag source orDnDConstants.ACTION_NONEif this drop action is not supported by the drag source.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_MOVE If the user selects a drop action, the user drop action is one ofDnDConstantsthat represents the selected drop action if this drop action is supported by the drag source orDnDConstants.ACTION_NONEif this drop action is not supported by the drag source.If the user doesn't select a drop action, the set of DnDConstantsthat represents the set of drop actions supported by the drag source is searched forDnDConstants.ACTION_MOVE, then forDnDConstants.ACTION_COPY, then forDnDConstants.ACTION_LINKand the user drop action is the first constant found. If no constant is found the user drop action isDnDConstants.ACTION_NONE.- Since:
- 1.2
- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields declared in class java.util.EventObjectsource
 
- 
 - 
Constructor SummaryConstructors Constructor Description DragSourceDragEvent(DragSourceContext dsc, int dropAction, int action, int modifiers)Constructs aDragSourceDragEvent.DragSourceDragEvent(DragSourceContext dsc, int dropAction, int action, int modifiers, int x, int y)Constructs aDragSourceDragEventgiven the specifiedDragSourceContext, user drop action, target drop action, modifiers and coordinates.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDropAction()This method returns the logical intersection of the target drop action and the set of drop actions supported by the drag source.intgetGestureModifiers()This method returns anintrepresenting the current state of the input device modifiers associated with the user's gesture.intgetGestureModifiersEx()This method returns anintrepresenting the current state of the input device extended modifiers associated with the user's gesture.intgetTargetActions()This method returns the target drop action.intgetUserAction()This method returns the user drop action.- 
Methods declared in class java.awt.dnd.DragSourceEventgetDragSourceContext, getLocation, getX, getY
 - 
Methods declared in class java.util.EventObjectgetSource, toString
 
- 
 
- 
- 
- 
Constructor Detail- 
DragSourceDragEventpublic DragSourceDragEvent(DragSourceContext dsc, int dropAction, int action, int modifiers) Constructs aDragSourceDragEvent. This class is typically instantiated by theDragSourceContextPeerrather than directly by client code. The coordinates for thisDragSourceDragEventare not specified, sogetLocationwill returnnullfor this event.The arguments dropActionandactionshould be one ofDnDConstantsthat represents a single action. The argumentmodifiersshould be either a bitwise mask of oldjava.awt.event.InputEvent.*_MASKconstants or a bitwise mask of extendedjava.awt.event.InputEvent.*_DOWN_MASKconstants. This constructor does not throw any exception for invaliddropAction,actionandmodifiers.- Parameters:
- dsc- the- DragSourceContextthat is to manage notifications for this event.
- dropAction- the user drop action.
- action- the target drop action.
- modifiers- the modifier keys down during event (shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
- Throws:
- IllegalArgumentException- if- dscis- null.
- See Also:
- InputEvent,- DragSourceEvent.getLocation()
 
 - 
DragSourceDragEventpublic DragSourceDragEvent(DragSourceContext dsc, int dropAction, int action, int modifiers, int x, int y) Constructs aDragSourceDragEventgiven the specifiedDragSourceContext, user drop action, target drop action, modifiers and coordinates.The arguments dropActionandactionshould be one ofDnDConstantsthat represents a single action. The argumentmodifiersshould be either a bitwise mask of oldjava.awt.event.InputEvent.*_MASKconstants or a bitwise mask of extendedjava.awt.event.InputEvent.*_DOWN_MASKconstants. This constructor does not throw any exception for invaliddropAction,actionandmodifiers.- Parameters:
- dsc- the- DragSourceContextassociated with this event.
- dropAction- the user drop action.
- action- the target drop action.
- modifiers- the modifier keys down during event (shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
- x- the horizontal coordinate for the cursor location
- y- the vertical coordinate for the cursor location
- Throws:
- IllegalArgumentException- if- dscis- null.
- Since:
- 1.4
- See Also:
- InputEvent
 
 
- 
 - 
Method Detail- 
getTargetActionspublic int getTargetActions() This method returns the target drop action.- Returns:
- the target drop action.
 
 - 
getGestureModifierspublic int getGestureModifiers() This method returns anintrepresenting the current state of the input device modifiers associated with the user's gesture. Typically these would be mouse buttons or keyboard modifiers.If the modifierspassed to the constructor are invalid, this method returns them unchanged.- Returns:
- the current state of the input device modifiers
 
 - 
getGestureModifiersExpublic int getGestureModifiersEx() This method returns anintrepresenting the current state of the input device extended modifiers associated with the user's gesture. SeeInputEvent.getModifiersEx()If the modifierspassed to the constructor are invalid, this method returns them unchanged.- Returns:
- the current state of the input device extended modifiers
- Since:
- 1.4
 
 - 
getUserActionpublic int getUserAction() This method returns the user drop action.- Returns:
- the user drop action.
 
 - 
getDropActionpublic int getDropAction() This method returns the logical intersection of the target drop action and the set of drop actions supported by the drag source.- Returns:
- the logical intersection of the target drop action and the set of drop actions supported by the drag source.
 
 
- 
 
-