java.awt.dnd
Class DragGestureEvent

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

public class DragGestureEvent
extends EventObject

Safe:

See Also:
Serialized Form

Field Summary
private  int action
          The user's preferred action.
private  Component component
          The Component associated with this DragGestureEvent.
private  DragSource dragSource
          The DragSource associated with this DragGestureEvent.
private  List events
           
private  Point origin
          The origin of the drag.
private static long serialVersionUID
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori, List evs)
          Suppressed: 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()
          Suppressed: Returns the Component associated with this DragGestureEvent.
 int getDragAction()
          Enabled: Returns an int representing the action selected by the user.
 Point getDragOrigin()
          Enabled: Returns a Point in the coordinates of the Component over which the drag originated.
 DragSource getDragSource()
          Enabled: Returns the DragSource.
 DragGestureRecognizer getSourceAsDragGestureRecognizer()
          Enabled: Returns the source as a DragGestureRecognizer.
 InputEvent getTriggerEvent()
          Suppressed: Returns the initial event that triggered the gesture.
 Iterator iterator()
          Suppressed: Returns an Iterator for the events comprising the gesture.
private  void readObject(ObjectInputStream s)
          Deserializes this DragGestureEvent.
 void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)
          Enabled: 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)
          Suppressed: Starts the drag operation given the Cursor for this drag operation and the Transferable representing the source data for this drag operation.
 void startDrag(Cursor dragCursor, Transferable transferable, DragSourceListener dsl)
          Enabled: Starts the drag given the initial Cursor to display, the Transferable object, and the DragSourceListener to use.
 Object[] toArray()
          Suppressed: Returns an Object array of the events comprising the drag gesture.
 Object[] toArray(Object[] array)
          Suppressed: Returns an array of the events comprising the drag gesture.
private  void writeObject(ObjectOutputStream s)
          Serializes this DragGestureEvent.
 
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
 

Field Detail

serialVersionUID

private static final long serialVersionUID

events

private transient List events

dragSource

private DragSource dragSource
The DragSource associated with this DragGestureEvent.


component

private Component component
The Component associated with this DragGestureEvent.


origin

private Point origin
The origin of the drag.


action

private int action
The user's preferred action.

Constructor Detail

DragGestureEvent

public DragGestureEvent(DragGestureRecognizer dgr,
                        int act,
                        Point ori,
                        List evs)
Suppressed: 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()
Enabled: Returns the source as a DragGestureRecognizer.

Returns:
the source as a DragGestureRecognizer

getComponent

public Component getComponent()
Suppressed: Returns the Component associated with this DragGestureEvent.

Returns:
the Component

getDragSource

public DragSource getDragSource()
Enabled: Returns the DragSource.

Returns:
the DragSource

getDragOrigin

public Point getDragOrigin()
Enabled: 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()
Suppressed: Returns an Iterator for the events comprising the gesture.

Returns:
an Iterator for the events comprising the gesture

toArray

public Object[] toArray()
Suppressed: 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)
Suppressed: 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()
Enabled: Returns an int representing the action selected by the user.

Returns:
the action selected by the user

getTriggerEvent

public InputEvent getTriggerEvent()
Suppressed: 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
Suppressed: 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:
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 the Transferable is null.
InvalidDnDOperationException
Since:
1.4

startDrag

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

startDrag

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

writeObject

private void writeObject(ObjectOutputStream s)
                  throws IOException
Serializes this DragGestureEvent. Performs default serialization and then writes out this object's List of gesture events if and only if the List can be serialized. If not, null is written instead. In this case, a DragGestureEvent created from the resulting deserialized stream will contain an empty List of gesture events.

IOException
Since:
1.4

readObject

private void readObject(ObjectInputStream s)
                 throws ClassNotFoundException,
                        IOException
Deserializes this DragGestureEvent. This method first performs default deserialization for all non-transient fields. An attempt is then made to deserialize this object's List of gesture events as well. This is first attempted by deserializing the field events, because, in releases prior to 1.4, a non-transient field of this name stored the List of gesture events. If this fails, the next object in the stream is used instead. If the resulting List is null, this object's List of gesture events is set to an empty List.

ClassNotFoundException
IOException
Since:
1.4


comments?