public class

DragGestureEvent

extends EventObject
java.lang.Object
   ↳ java.util.EventObject
     ↳ java.awt.dnd.DragGestureEvent

Class Overview

A DragGestureEvent is passed to DragGestureListener's dragGestureRecognized() method when a particular DragGestureRecognizer detects that a platform dependent drag initiating gesture has occurred on the Component that it is tracking.

Summary

[Expand]
Inherited Fields
From class java.util.EventObject
Public Constructors
DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori, List<? extends InputEvent> evs)
Construct a DragGestureEvent given the DragGestureRecognizer firing this event, an int representing the user's preferred action, a Point indicating the origin of the drag, and a List of events that comprise the gesture.
Public Methods
Component getComponent()
Returns the Component associated with this DragGestureEvent.
int getDragAction()
Returns an int representing the action selected by the user.
Point getDragOrigin()
Returns a Point in the coordinates of the Component over which the drag originated.
DragSource getDragSource()
Returns the DragSource.
DragGestureRecognizer getSourceAsDragGestureRecognizer()
Returns the source as a DragGestureRecognizer.
InputEvent getTriggerEvent()
Returns the initial event that triggered the gesture.
Iterator<InputEvent> iterator()
Returns an Iterator for the events comprising the gesture.
void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)
Start the drag given the initial Cursor to display, a drag Image, the offset of the Image, the Transferable object, and the DragSourceListener to use.
void startDrag(Cursor dragCursor, Transferable transferable, DragSourceListener dsl)
Starts the drag given the initial Cursor to display, the Transferable object, and the DragSourceListener to use.
void startDrag(Cursor dragCursor, Transferable transferable)
Starts the drag operation given the Cursor for this drag operation and the Transferable representing the source data for this drag operation.
Object[] toArray()
Returns an Object array of the events comprising the drag gesture.
Object[] toArray(Object[] array)
Returns an array of the events comprising the drag gesture.
[Expand]
Inherited Methods
From class java.util.EventObject
From class java.lang.Object

Public Constructors

public DragGestureEvent (DragGestureRecognizer dgr, int act, Point ori, List<? extends InputEvent> evs)

Construct a DragGestureEvent given the DragGestureRecognizer firing this event, an int representing the user's preferred action, a Point indicating the origin of the drag, and a List of events that comprise the gesture.

Parameters
dgr The DragGestureRecognizer firing this event
act The the user's preferred action
ori The origin of the drag
evs The List of events that comprise the gesture

Throws
if input parameters are null

Public Methods

public Component getComponent ()

Returns the Component associated with this DragGestureEvent.

Returns
  • the Component

public int getDragAction ()

Returns an int representing the action selected by the user.

Returns
  • the action selected by the user

public Point getDragOrigin ()

Returns a Point in the coordinates of the Component over which the drag originated.

Returns
  • the Point where the drag originated in Component coords.

public DragSource getDragSource ()

Returns the DragSource.

Returns
  • the DragSource

public DragGestureRecognizer getSourceAsDragGestureRecognizer ()

Returns the source as a DragGestureRecognizer.

Returns
  • the source as a DragGestureRecognizer

public InputEvent getTriggerEvent ()

Returns the initial event that triggered the gesture.

Returns
  • the first "triggering" event in the sequence of the gesture

public Iterator<InputEvent> iterator ()

Returns an Iterator for the events comprising the gesture.

Returns
  • an Iterator for the events comprising the gesture

public void startDrag (Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)

Start the drag given the initial Cursor to display, a drag Image, the offset of the Image, the Transferable object, and the DragSourceListener to use.

Parameters
dragCursor The initial drag Cursor
dragImage The source's dragImage
imageOffset The dragImage's offset
transferable The source's Transferable
dsl The source's DragSourceListener

Throws
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.
InvalidDnDOperationException

public void startDrag (Cursor dragCursor, Transferable transferable, DragSourceListener dsl)

Starts the drag given the initial Cursor to display, the Transferable object, and the DragSourceListener to use.

Parameters
dragCursor The initial drag Cursor
transferable The source's Transferable
dsl The source's DragSourceListener

Throws
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.
InvalidDnDOperationException

public void startDrag (Cursor dragCursor, Transferable transferable)

Starts the drag operation given the Cursor for this drag operation and the Transferable representing the source data for this drag operation.
If a null Cursor is specified no exception will be thrown and default drag cursors will be used instead.
If a null Transferable is specified NullPointerException will be thrown.

Parameters
dragCursor The Cursor for this drag operation
transferable The Transferable representing the source data for this drag operation.
Throws
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.
if the Transferable is null.
InvalidDnDOperationException

public Object[] toArray ()

Returns an Object array of the events comprising the drag gesture.

Returns
  • an array of the events comprising the gesture

public Object[] toArray (Object[] array)

Returns an array of the events comprising the drag gesture.

Parameters
array the array of EventObject sub(types)

Returns
  • an array of the events comprising the gesture