- java.lang.Object
-
- java.util.EventObject
-
- java.awt.dnd.DragGestureEvent
-
- All Implemented Interfaces:
- Serializable
public class DragGestureEvent extends EventObject
ADragGestureEvent
is passed toDragGestureListener
's dragGestureRecognized() method when a particularDragGestureRecognizer
detects that a platform dependent drag initiating gesture has occurred on theComponent
that it is tracking. Theaction
field of anyDragGestureEvent
instance should take one of the following values:-
DnDConstants.ACTION_COPY
-
DnDConstants.ACTION_MOVE
-
DnDConstants.ACTION_LINK
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and Description DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori, List<? extends InputEvent> evs)
Constructs aDragGestureEvent
object given by theDragGestureRecognizer
instance firing this event, anact
parameter representing the user's preferred action, anori
parameter indicating the origin of the drag, and aList
of events that comprise the gesture(evs
parameter).
-
Method Summary
Methods Modifier and Type Method and Description Component
getComponent()
Returns theComponent
associated with thisDragGestureEvent
.int
getDragAction()
Returns anint
representing the action selected by the user.Point
getDragOrigin()
Returns aPoint
in the coordinates of theComponent
over which the drag originated.DragSource
getDragSource()
Returns theDragSource
.DragGestureRecognizer
getSourceAsDragGestureRecognizer()
Returns the source as aDragGestureRecognizer
.InputEvent
getTriggerEvent()
Returns the initial event that triggered the gesture.Iterator<InputEvent>
iterator()
Returns anIterator
for the events comprising the gesture.void
startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)
Start the drag given the initialCursor
to display, a dragImage
, the offset of theImage
, theTransferable
object, and theDragSourceListener
to use.void
startDrag(Cursor dragCursor, Transferable transferable)
Starts the drag operation given theCursor
for this drag operation and theTransferable
representing the source data for this drag operation.void
startDrag(Cursor dragCursor, Transferable transferable, DragSourceListener dsl)
Starts the drag given the initialCursor
to display, theTransferable
object, and theDragSourceListener
to use.Object[]
toArray()
Returns anObject
array of the events comprising the drag gesture.Object[]
toArray(Object[] array)
Returns an array of the events comprising the drag gesture.
-
-
-
Constructor Detail
-
DragGestureEvent
public DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori, List<? extends InputEvent> evs)
Constructs aDragGestureEvent
object given by theDragGestureRecognizer
instance firing this event, anact
parameter representing the user's preferred action, anori
parameter indicating the origin of the drag, and aList
of events that comprise the gesture(evs
parameter).- Parameters:
dgr
- TheDragGestureRecognizer
firing this eventact
- The user's preferred action. For information on allowable values, see the class description forDragGestureEvent
ori
- The origin of the dragevs
- TheList
of events that comprise the gesture- Throws:
IllegalArgumentException
- if any parameter equalsnull
IllegalArgumentException
- if the act parameter does not comply with the values given in the class description forDragGestureEvent
- See Also:
DnDConstants
-
-
Method Detail
-
getSourceAsDragGestureRecognizer
public DragGestureRecognizer getSourceAsDragGestureRecognizer()
Returns the source as aDragGestureRecognizer
.- Returns:
- the source as a
DragGestureRecognizer
-
getComponent
public Component getComponent()
Returns theComponent
associated with thisDragGestureEvent
.- Returns:
- the Component
-
getDragSource
public DragSource getDragSource()
Returns theDragSource
.- Returns:
- the
DragSource
-
getDragOrigin
public Point getDragOrigin()
Returns aPoint
in the coordinates of theComponent
over which the drag originated.- Returns:
- the Point where the drag originated in Component coords.
-
iterator
public Iterator<InputEvent> iterator()
Returns anIterator
for the events comprising the gesture.- Returns:
- an Iterator for the events comprising the gesture
-
toArray
public Object[] toArray()
Returns anObject
array of the events comprising the drag gesture.- Returns:
- an array of the events comprising the gesture
-
toArray
public Object[] toArray(Object[] array)
Returns an array of the events comprising the drag gesture.- Parameters:
array
- the array ofEventObject
sub(types)- Returns:
- an array of the events comprising the gesture
-
getDragAction
public int getDragAction()
Returns anint
representing the action selected by the user.- Returns:
- the action selected by the user
-
getTriggerEvent
public InputEvent getTriggerEvent()
Returns the initial event that triggered the gesture.- Returns:
- the first "triggering" event in the sequence of the gesture
-
startDrag
public void startDrag(Cursor dragCursor, Transferable transferable) throws InvalidDnDOperationException
Starts the drag operation given theCursor
for this drag operation and theTransferable
representing the source data for this drag operation.
If anull
Cursor
is specified no exception will be thrown and default drag cursors will be used instead.
If anull
Transferable
is specifiedNullPointerException
will be thrown.- Parameters:
dragCursor
- The initialCursor
for this drag operation ornull
for the default cursor handling; see DragSourceContext for more details on the cursor handling mechanism during drag and droptransferable
- TheTransferable
representing the source data for this drag operation.- Throws:
InvalidDnDOperationException
- if the Drag and Drop system is unable to initiate a drag operation, or if the user attempts to start a drag while an existing drag operation is still executing.NullPointerException
- if theTransferable
isnull
- Since:
- 1.4
-
startDrag
public void startDrag(Cursor dragCursor, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
Starts the drag given the initialCursor
to display, theTransferable
object, and theDragSourceListener
to use.- Parameters:
dragCursor
- The initialCursor
for this drag operation ornull
for the default cursor handling; see DragSourceContext for more details on the cursor handling mechanism during drag and droptransferable
- The source's Transferabledsl
- The source's DragSourceListener- Throws:
InvalidDnDOperationException
- if the Drag and Drop system is unable to initiate a drag operation, or if the user attempts to start a drag while an existing drag operation is still executing.
-
startDrag
public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
Start the drag given the initialCursor
to display, a dragImage
, the offset of theImage
, theTransferable
object, and theDragSourceListener
to use.- Parameters:
dragCursor
- The initialCursor
for this drag operation ornull
for the default cursor handling; see DragSourceContext for more details on the cursor handling mechanism during drag and dropdragImage
- The source's dragImageimageOffset
- The dragImage's offsettransferable
- The source's Transferabledsl
- The source's DragSourceListener- Throws:
InvalidDnDOperationException
- if the Drag and Drop system is unable to initiate a drag operation, or if the user attempts to start a drag while an existing drag operation is still executing.
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/awt/dnd/DragGestureEvent.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.