- java.lang.Object
-
- java.util.EventObject
-
- java.awt.dnd.DragSourceEvent
-
- java.awt.dnd.DragSourceDragEvent
-
- All Implemented Interfaces:
- Serializable
public class DragSourceDragEvent extends DragSourceEvent
TheDragSourceDragEvent
is delivered from theDragSourceContextPeer
, via theDragSourceContext
, to theDragSourceListener
registered with thatDragSourceContext
and with its associatedDragSource
.The
DragSourceDragEvent
reports the target drop action and the user drop action that reflect the current state of the drag operation.Target drop action is one of
DnDConstants
that represents the drop action selected by the current drop target if this drop action is supported by the drag source orDnDConstants.ACTION_NONE
if 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 ofDnDConstants
that represents the selected drop action if this drop action is supported by the drag source orDnDConstants.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 forDnDConstants.ACTION_MOVE
, then forDnDConstants.ACTION_COPY
, then forDnDConstants.ACTION_LINK
and 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 inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and 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 aDragSourceDragEvent
given the specifiedDragSourceContext
, user drop action, target drop action, modifiers and coordinates.
-
Method Summary
Methods Modifier and Type Method and Description int
getDropAction()
This method returns the logical intersection of the target drop action and the set of drop actions supported by the drag source.int
getGestureModifiers()
This method returns anint
representing the current state of the input device modifiers associated with the user's gesture.int
getGestureModifiersEx()
This method returns anint
representing the current state of the input device extended modifiers associated with the user's gesture.int
getTargetActions()
This method returns the target drop action.int
getUserAction()
This method returns the user drop action.-
Methods inherited from class java.awt.dnd.DragSourceEvent
getDragSourceContext, getLocation, getX, getY
-
-
-
-
Constructor Detail
-
DragSourceDragEvent
public DragSourceDragEvent(DragSourceContext dsc, int dropAction, int action, int modifiers)
Constructs aDragSourceDragEvent
. This class is typically instantiated by theDragSourceContextPeer
rather than directly by client code. The coordinates for thisDragSourceDragEvent
are not specified, sogetLocation
will returnnull
for this event.The arguments
dropAction
andaction
should be one ofDnDConstants
that represents a single action. The argumentmodifiers
should be either a bitwise mask of oldjava.awt.event.InputEvent.*_MASK
constants or a bitwise mask of extendedjava.awt.event.InputEvent.*_DOWN_MASK
constants. This constructor does not throw any exception for invaliddropAction
,action
andmodifiers
.- Parameters:
dsc
- theDragSourceContext
that 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:
- ifIllegalArgumentException
dsc
isnull
.- See Also:
InputEvent
,DragSourceEvent.getLocation()
-
DragSourceDragEvent
public DragSourceDragEvent(DragSourceContext dsc, int dropAction, int action, int modifiers, int x, int y)
Constructs aDragSourceDragEvent
given the specifiedDragSourceContext
, user drop action, target drop action, modifiers and coordinates.The arguments
dropAction
andaction
should be one ofDnDConstants
that represents a single action. The argumentmodifiers
should be either a bitwise mask of oldjava.awt.event.InputEvent.*_MASK
constants or a bitwise mask of extendedjava.awt.event.InputEvent.*_DOWN_MASK
constants. This constructor does not throw any exception for invaliddropAction
,action
andmodifiers
.- Parameters:
dsc
- theDragSourceContext
associated 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 locationy
- the vertical coordinate for the cursor location- Throws:
- ifIllegalArgumentException
dsc
isnull
.- Since:
- 1.4
- See Also:
InputEvent
-
-
Method Detail
-
getTargetActions
public int getTargetActions()
This method returns the target drop action.- Returns:
- the target drop action.
-
getGestureModifiers
public int getGestureModifiers()
This method returns anint
representing 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
modifiers
passed to the constructor are invalid, this method returns them unchanged.- Returns:
- the current state of the input device modifiers
-
getGestureModifiersEx
public int getGestureModifiersEx()
This method returns anint
representing the current state of the input device extended modifiers associated with the user's gesture. SeeInputEvent.getModifiersEx()
If the
modifiers
passed to the constructor are invalid, this method returns them unchanged.- Returns:
- the current state of the input device extended modifiers
- Since:
- 1.4
-
getUserAction
public int getUserAction()
This method returns the user drop action.- Returns:
- the user drop action.
-
getDropAction
public 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.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/awt/dnd/DragSourceDragEvent.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.