Save This Page
Home » openjdk-7 » java » awt » dnd » [javadoc | source]
java.awt.dnd
public class: DragGestureEvent [javadoc | source]
java.lang.Object
   java.util.EventObject
      java.awt.dnd.DragGestureEvent
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. The {@code action} field of any {@code DragGestureEvent} instance should take one of the following values: Assigning the value different from listed above will cause an unspecified behavior.
Constructor:
 public DragGestureEvent(DragGestureRecognizer dgr,
    int act,
    Point ori,
    List<InputEvent> evs) 
    Constructs a DragGestureEvent object given by the DragGestureRecognizer instance firing this event, an {@code act} parameter representing the user's preferred action, an {@code ori} parameter indicating the origin of the drag, and a {@code List} of events that comprise the gesture({@code evs} parameter).

    Parameters:
    dgr - The DragGestureRecognizer firing this event
    act - The user's preferred action. For information on allowable values, see the class description for DragGestureEvent
    ori - The origin of the drag
    evs - The List of events that comprise the gesture


    Throws:
    IllegalArgumentException - if any parameter equals {@code null}
    IllegalArgumentException - if the act parameter does not comply with the values given in the class description for DragGestureEvent
    Also see:
    java.awt.dnd.DnDConstants
Method from java.awt.dnd.DragGestureEvent Summary:
getComponent,   getDragAction,   getDragOrigin,   getDragSource,   getSourceAsDragGestureRecognizer,   getTriggerEvent,   iterator,   startDrag,   startDrag,   startDrag,   toArray,   toArray
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.awt.dnd.DragGestureEvent Detail:
 public Component getComponent() 
    Returns the Component associated with this DragGestureEvent.

 public int getDragAction() 
    Returns an int representing the action selected by the user.

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

 public DragSource getDragSource() 
    Returns the DragSource.

 public DragGestureRecognizer getSourceAsDragGestureRecognizer() 
    Returns the source as a DragGestureRecognizer.

 public InputEvent getTriggerEvent() 
    Returns the initial event that triggered the gesture.

 public Iterator<InputEvent> iterator() 
    Returns an Iterator for the events comprising the gesture.

 public  void startDrag(Cursor dragCursor,
    Transferable transferable) throws InvalidDnDOperationException 
    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.
 public  void startDrag(Cursor dragCursor,
    Transferable transferable,
    DragSourceListener dsl) throws InvalidDnDOperationException 
    Starts the drag given the initial Cursor to display, the Transferable object, and the DragSourceListener to use.

 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.

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

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