Java Platform 1.2

java.awt.dnd
Class DragSource

java.lang.Object
  |
  +--java.awt.dnd.DragSource

public class DragSource
extends Object

The DragSource class is a small class responsible for originating a Drag and Drop gesture.

Since:
JDK1.2

Field Summary
static Cursor DefaultCopyDrop
          Default Cursor Constants
static Cursor DefaultCopyNoDrop
           
static Cursor DefaultLinkDrop
           
static Cursor DefaultLinkNoDrop
           
static Cursor DefaultMoveDrop
           
static Cursor DefaultMoveNoDrop
           
 
Constructor Summary
DragSource()
          construct a DragSource
 
Method Summary
 DragGestureRecognizer createDefaultDragGestureRecognizer(Component c, int actions, DragGestureListener dgl)
          Creates a new DragSourceRecognizer that implements the default abstract subclass of DragGestureRecognizer for this DragSource, and sets the specified Component and DragGestureListener on the newly created object.
 DragGestureRecognizer createDragGestureRecognizer(Class recognizerAbstractClass, Component c, int actions, DragGestureListener dgl)
          Creates a new DragSourceRecognizer that implements the specified abstract subclass of DragGestureRecognizer, and sets the specified Component and DragGestureListener on the newly created object.
protected  DragSourceContext createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp, DragGestureEvent dgl, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable t, DragSourceListener dsl)
          Create the DragSourceContext to handle this Drag.
static DragSource getDefaultDragSource()
           
 FlavorMap getFlavorMap()
           
static boolean isDragImageSupported()
           
 void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point dragOffset, Transferable transferable, DragSourceListener dsl)
          start a Drag.
 void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl, FlavorMap flavorMap)
          start a Drag.
 void startDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable transferable, DragSourceListener dsl)
          start a Drag.
 void startDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable transferable, DragSourceListener dsl, FlavorMap flavorMap)
          start a Drag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DefaultCopyDrop

public static final Cursor DefaultCopyDrop
Default Cursor Constants

DefaultMoveDrop

public static final Cursor DefaultMoveDrop

DefaultLinkDrop

public static final Cursor DefaultLinkDrop

DefaultCopyNoDrop

public static final Cursor DefaultCopyNoDrop

DefaultMoveNoDrop

public static final Cursor DefaultMoveNoDrop

DefaultLinkNoDrop

public static final Cursor DefaultLinkNoDrop
Constructor Detail

DragSource

public DragSource()
construct a DragSource
Method Detail

getDefaultDragSource

public static DragSource getDefaultDragSource()
Returns:
the platform DragSource

isDragImageSupported

public static boolean isDragImageSupported()
Returns:
if the Drag Image support is available on this platform

startDrag

public void startDrag(DragGestureEvent trigger,
                      Cursor dragCursor,
                      Image dragImage,
                      Point imageOffset,
                      Transferable transferable,
                      DragSourceListener dsl,
                      FlavorMap flavorMap)
               throws InvalidDnDOperationException
start a Drag.
Parameters:
trigger - The DragGestureEvemt that initiated the Drag
dragCursor - The initial cursor or null for defaults
dragImage - The image to drag or null
imageOffset - The offset of the image origin from the hotspot of the cursor at the instant of the trigger
transferable - The subject data of the Drag
dsl - The DragSourceListener
flavorMap - The FlavorMap to use, or null

startDrag

public void startDrag(DragGestureEvent trigger,
                      Cursor dragCursor,
                      Transferable transferable,
                      DragSourceListener dsl,
                      FlavorMap flavorMap)
               throws InvalidDnDOperationException
start a Drag.
Parameters:
trigger - The DragGestureEvent that initiated the Drag
actions - The drag "verbs" appropriate
dragCursor - The initial cursor or null for defaults
transferable - The subject data of the Drag
dsl - The DragSourceListener
flavorMap - The FlavorMap to use or null

startDrag

public void startDrag(DragGestureEvent trigger,
                      Cursor dragCursor,
                      Image dragImage,
                      Point dragOffset,
                      Transferable transferable,
                      DragSourceListener dsl)
               throws InvalidDnDOperationException
start a Drag.
Parameters:
trigger - The DragGestureEvent that initiated the Drag
actions - The drag "verbs" appropriate
dragCursor - The initial cursor or null for defaults
dragImage - The image to drag or null
imageOffset - The offset of the image origin from the hotspot of the cursor at the instant of the trigger
transferable - The subject data of the Drag
dsl - The DragSourceListener

startDrag

public void startDrag(DragGestureEvent trigger,
                      Cursor dragCursor,
                      Transferable transferable,
                      DragSourceListener dsl)
               throws InvalidDnDOperationException
start a Drag.
Parameters:
trigger - The DragGestureEvent that initiated the Drag
actions - The drag "verbs" appropriate
dragCursor - The initial cursor or null for defaults
transferable - The subject data of the Drag
dsl - The DragSourceListener

createDragSourceContext

protected DragSourceContext createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp,
                                                    DragGestureEvent dgl,
                                                    Cursor dragCursor,
                                                    Image dragImage,
                                                    Point imageOffset,
                                                    Transferable t,
                                                    DragSourceListener dsl)
Create the DragSourceContext to handle this Drag. To incorporate a new DragSourceContext subclass, subclass DragSource and override this method.
Parameters:
dscp - The DragSourceContextPeer for this Drag
trigger - The DragGestureEvent that triggered the drag
dragCursor - The initial cursor
dragImage - The image to drag or null
imageOffset - The offset of the image origin from the hotspot of the cursor at the instant of the trigger
transferable - The subject data of the Drag
dsl - The DragSourceListener

getFlavorMap

public FlavorMap getFlavorMap()
Returns:
the FlavorMap for this DragSource

createDragGestureRecognizer

public DragGestureRecognizer createDragGestureRecognizer(Class recognizerAbstractClass,
                                                         Component c,
                                                         int actions,
                                                         DragGestureListener dgl)
Creates a new DragSourceRecognizer that implements the specified abstract subclass of DragGestureRecognizer, and sets the specified Component and DragGestureListener on the newly created object.
Parameters:
recognizerAbstractClass - The requested abstract type
actions - The permitted source drag actions
c - The Component target
dgl - The DragGestureListener to notify
Returns:
the new DragGestureRecognizer or null

createDefaultDragGestureRecognizer

public DragGestureRecognizer createDefaultDragGestureRecognizer(Component c,
                                                                int actions,
                                                                DragGestureListener dgl)
Creates a new DragSourceRecognizer that implements the default abstract subclass of DragGestureRecognizer for this DragSource, and sets the specified Component and DragGestureListener on the newly created object. For this DragSource the defaut is MouseDragGestureRecognizer
Parameters:
c - The Component target for the recognizer
actions - The permitted source actions
dgl - The DragGestureListener to notify
Returns:
the new DragGestureRecognizer or null

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.