JavaTM 2 Platform
Std. Ed. v1.3

java.awt.dnd
Class DragGestureEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--java.awt.dnd.DragGestureEvent
All Implemented Interfaces:
Serializable

public class DragGestureEvent
extends EventObject

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.

See Also:
DragGestureRecognizer, DragGestureListener, DragSource, Serialized Form

Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori, List 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.
 
Method Summary
 Component getComponent()
          This method returns the Component associated with this DragGestureEvent.
 int getDragAction()
          This method returns an int representing the action selected by the user.
 Point getDragOrigin()
          This method returns a Point in the coordinates of the Component over which the drag originated.
 DragSource getDragSource()
          This method returns the DragSource.
 DragGestureRecognizer getSourceAsDragGestureRecognizer()
          This method returns the source as a DragGestureRecognizer.
 InputEvent getTriggerEvent()
          This method returns the initial event that triggered the gesture.
 Iterator iterator()
          This method 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)
          Start the drag given the initial Cursor to display, the Transferable object, and the DragSourceListener to use.
 Object[] toArray()
          This method returns an Object array of the events comprising the drag gesture.
 Object[] toArray(Object[] array)
          This method returns an array of the events comprising the drag gesture.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DragGestureEvent

public DragGestureEvent(DragGestureRecognizer dgr,
                        int act,
                        Point ori,
                        List 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:
IllegalArgumentException - if input parameters are null
Method Detail

getSourceAsDragGestureRecognizer

public DragGestureRecognizer getSourceAsDragGestureRecognizer()
This method returns the source as a DragGestureRecognizer.

Returns:
the source as a DragGestureRecognizer

getComponent

public Component getComponent()
This method returns the Component associated with this DragGestureEvent.

Returns:
the Component

getDragSource

public DragSource getDragSource()
This method returns the DragSource.

Returns:
the DragSource

getDragOrigin

public Point getDragOrigin()
This method returns a Point in the coordinates of the Component over which the drag originated.

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

iterator

public Iterator iterator()
This method returns an Iterator for the events comprising the gesture.

Returns:
an Iterator for the events comprising the gesture

toArray

public Object[] toArray()
This method returns an Object array of the events comprising the drag gesture.

Returns:
an array of the events comprising the gesture

toArray

public Object[] toArray(Object[] array)
This method 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

getDragAction

public int getDragAction()
This method returns an int representing the action selected by the user.

Returns:
the action selected by the user

getTriggerEvent

public InputEvent getTriggerEvent()
This method returns the initial event that triggered the gesture.


startDrag

public void startDrag(Cursor dragCursor,
                      Transferable transferable,
                      DragSourceListener dsl)
               throws InvalidDnDOperationException
Start 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:
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 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:
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.

JavaTM 2 Platform
Std. Ed. v1.3

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.