java.awt.dnd
Class DragSource

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.dnd.DragSource
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class DragSource
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

The DragSource is the entity responsible for the initiation of the Drag and Drop operation, and may be used in a number of scenarios:

Once the DragSource is obtained, a DragGestureRecognizer should also be obtained to associate the DragSource with a particular Component.

The initial interpretation of the user's gesture, and the subsequent starting of the drag operation are the responsibility of the implementing Component, which is usually implemented by a DragGestureRecognizer.

When a drag gesture occurs, the DragSource's startDrag() method shall be invoked in order to cause processing of the user's navigational gestures and delivery of Drag and Drop protocol notifications. A DragSource shall only permit a single Drag and Drop operation to be current at any one time, and shall reject any further startDrag() requests by throwing an IllegalDnDOperationException until such time as the extant operation is complete.

The startDrag() method invokes the createDragSourceContext() method to instantiate an appropriate DragSourceContext and associate the DragSourceContextPeer with that.

If the Drag and Drop System is unable to initiate a drag operation for some reason, the startDrag() method throws a java.awt.dnd.InvalidDnDOperationException to signal such a condition. Typically this exception is thrown when the underlying platform system is either not in a state to initiate a drag, or the parameters specified are invalid.

Note that during the drag, the set of operations exposed by the source at the start of the drag operation may not change until the operation is complete. The operation(s) are constant for the duration of the operation with respect to the DragSource.

Since:
1.2
See Also:
Serialized Form

Field Summary
static Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor DefaultCopyDrop sample code for java.awt.dnd.DragSource.DefaultCopyDrop definition code for java.awt.dnd.DragSource.DefaultCopyDrop
          The default Cursor to use with a copy operation indicating that a drop is currently allowed.
static Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor DefaultCopyNoDrop sample code for java.awt.dnd.DragSource.DefaultCopyNoDrop definition code for java.awt.dnd.DragSource.DefaultCopyNoDrop
          The default Cursor to use with a copy operation indicating that a drop is currently not allowed.
static Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor DefaultLinkDrop sample code for java.awt.dnd.DragSource.DefaultLinkDrop definition code for java.awt.dnd.DragSource.DefaultLinkDrop
          The default Cursor to use with a link operation indicating that a drop is currently allowed.
static Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor DefaultLinkNoDrop sample code for java.awt.dnd.DragSource.DefaultLinkNoDrop definition code for java.awt.dnd.DragSource.DefaultLinkNoDrop
          The default Cursor to use with a link operation indicating that a drop is currently not allowed.
static Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor DefaultMoveDrop sample code for java.awt.dnd.DragSource.DefaultMoveDrop definition code for java.awt.dnd.DragSource.DefaultMoveDrop
          The default Cursor to use with a move operation indicating that a drop is currently allowed.
static Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor DefaultMoveNoDrop sample code for java.awt.dnd.DragSource.DefaultMoveNoDrop definition code for java.awt.dnd.DragSource.DefaultMoveNoDrop
          The default Cursor to use with a move operation indicating that a drop is currently not allowed.
 
Constructor Summary
DragSource sample code for java.awt.dnd.DragSource.DragSource() definition code for java.awt.dnd.DragSource.DragSource() ()
          Creates a new DragSource.
 
Method Summary
 void addDragSourceListener sample code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) (DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
          Adds the specified DragSourceListener to this DragSource to receive drag source events during drag operations intiated with this DragSource.
 void addDragSourceMotionListener sample code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) (DragSourceMotionListener sample code for java.awt.dnd.DragSourceMotionListener definition code for java.awt.dnd.DragSourceMotionListener  dsml)
          Adds the specified DragSourceMotionListener to this DragSource to receive drag motion events during drag operations intiated with this DragSource.
 DragGestureRecognizer sample code for java.awt.dnd.DragGestureRecognizer definition code for java.awt.dnd.DragGestureRecognizer createDefaultDragGestureRecognizer sample code for java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(java.awt.Component, int, java.awt.dnd.DragGestureListener) definition code for java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(java.awt.Component, int, java.awt.dnd.DragGestureListener) (Component sample code for java.awt.Component definition code for java.awt.Component  c, int actions, DragGestureListener sample code for java.awt.dnd.DragGestureListener definition code for java.awt.dnd.DragGestureListener  dgl)
          Creates a new DragGestureRecognizer that implements the default abstract subclass of DragGestureRecognizer for this DragSource, and sets the specified Component and DragGestureListener on the newly created object.
<T extends DragGestureRecognizer sample code for java.awt.dnd.DragGestureRecognizer definition code for java.awt.dnd.DragGestureRecognizer >
T
createDragGestureRecognizer sample code for java.awt.dnd.DragSource.createDragGestureRecognizer(java.lang.Class, java.awt.Component, int, java.awt.dnd.DragGestureListener) definition code for java.awt.dnd.DragSource.createDragGestureRecognizer(java.lang.Class, java.awt.Component, int, java.awt.dnd.DragGestureListener) (Class sample code for java.lang.Class definition code for java.lang.Class <T> recognizerAbstractClass, Component sample code for java.awt.Component definition code for java.awt.Component  c, int actions, DragGestureListener sample code for java.awt.dnd.DragGestureListener definition code for java.awt.dnd.DragGestureListener  dgl)
          Creates a new DragGestureRecognizer that implements the specified abstract subclass of DragGestureRecognizer, and sets the specified Component and DragGestureListener on the newly created object.
protected  DragSourceContext sample code for java.awt.dnd.DragSourceContext definition code for java.awt.dnd.DragSourceContext createDragSourceContext sample code for java.awt.dnd.DragSource.createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer, java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer, java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) (DragSourceContextPeer sample code for java.awt.dnd.peer.DragSourceContextPeer definition code for java.awt.dnd.peer.DragSourceContextPeer  dscp, DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  dgl, Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor, Image sample code for java.awt.Image definition code for java.awt.Image  dragImage, Point sample code for java.awt.Point definition code for java.awt.Point  imageOffset, Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  t, DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
          Creates the DragSourceContext to handle this drag.
static DragSource sample code for java.awt.dnd.DragSource definition code for java.awt.dnd.DragSource getDefaultDragSource sample code for java.awt.dnd.DragSource.getDefaultDragSource() definition code for java.awt.dnd.DragSource.getDefaultDragSource() ()
          Gets the DragSource object associated with the underlying platform.
 DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener [] getDragSourceListeners sample code for java.awt.dnd.DragSource.getDragSourceListeners() definition code for java.awt.dnd.DragSource.getDragSourceListeners() ()
          Gets all the DragSourceListeners registered with this DragSource.
 DragSourceMotionListener sample code for java.awt.dnd.DragSourceMotionListener definition code for java.awt.dnd.DragSourceMotionListener [] getDragSourceMotionListeners sample code for java.awt.dnd.DragSource.getDragSourceMotionListeners() definition code for java.awt.dnd.DragSource.getDragSourceMotionListeners() ()
          Gets all of the DragSourceMotionListeners registered with this DragSource.
static int getDragThreshold sample code for java.awt.dnd.DragSource.getDragThreshold() definition code for java.awt.dnd.DragSource.getDragThreshold() ()
          Returns the drag gesture motion threshold.
 FlavorMap sample code for java.awt.datatransfer.FlavorMap definition code for java.awt.datatransfer.FlavorMap getFlavorMap sample code for java.awt.dnd.DragSource.getFlavorMap() definition code for java.awt.dnd.DragSource.getFlavorMap() ()
          This method returns the FlavorMap for this DragSource.
<T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener >
T[]
getListeners sample code for java.awt.dnd.DragSource.getListeners(java.lang.Class) definition code for java.awt.dnd.DragSource.getListeners(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
          Gets all the objects currently registered as FooListeners upon this DragSource.
static boolean isDragImageSupported sample code for java.awt.dnd.DragSource.isDragImageSupported() definition code for java.awt.dnd.DragSource.isDragImageSupported() ()
          Reports whether or not drag Image support is available on the underlying platform.
 void removeDragSourceListener sample code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener) (DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
          Removes the specified DragSourceListener from this DragSource.
 void removeDragSourceMotionListener sample code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) (DragSourceMotionListener sample code for java.awt.dnd.DragSourceMotionListener definition code for java.awt.dnd.DragSourceMotionListener  dsml)
          Removes the specified DragSourceMotionListener from this DragSource.
 void startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) (DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger, Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor, Image sample code for java.awt.Image definition code for java.awt.Image  dragImage, Point sample code for java.awt.Point definition code for java.awt.Point  dragOffset, Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable, DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
          Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Image to drag, the offset of the Image origin from the hotspot of the Cursor at the instant of the trigger, the subject data of the drag, and the DragSourceListener.
 void startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap) (DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger, Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor, Image sample code for java.awt.Image definition code for java.awt.Image  dragImage, Point sample code for java.awt.Point definition code for java.awt.Point  imageOffset, Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable, DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl, FlavorMap sample code for java.awt.datatransfer.FlavorMap definition code for java.awt.datatransfer.FlavorMap  flavorMap)
          Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Image to drag, the offset of the Image origin from the hotspot of the Cursor at the instant of the trigger, the Transferable subject data of the drag, the DragSourceListener, and the FlavorMap.
 void startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) (DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger, Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor, Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable, DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
          Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Transferable subject data of the drag, and the DragSourceListener.
 void startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap) (DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger, Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor, Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable, DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl, FlavorMap sample code for java.awt.datatransfer.FlavorMap definition code for java.awt.datatransfer.FlavorMap  flavorMap)
          Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Transferable subject data of the drag, the DragSourceListener, and the FlavorMap.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

DefaultCopyDrop sample code for java.awt.dnd.DragSource.DefaultCopyDrop

public static final Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  DefaultCopyDrop
The default Cursor to use with a copy operation indicating that a drop is currently allowed. null if GraphicsEnvironment.isHeadless() returns true.

See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

DefaultMoveDrop sample code for java.awt.dnd.DragSource.DefaultMoveDrop

public static final Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  DefaultMoveDrop
The default Cursor to use with a move operation indicating that a drop is currently allowed. null if GraphicsEnvironment.isHeadless() returns true.

See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

DefaultLinkDrop sample code for java.awt.dnd.DragSource.DefaultLinkDrop

public static final Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  DefaultLinkDrop
The default Cursor to use with a link operation indicating that a drop is currently allowed. null if GraphicsEnvironment.isHeadless() returns true.

See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

DefaultCopyNoDrop sample code for java.awt.dnd.DragSource.DefaultCopyNoDrop

public static final Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  DefaultCopyNoDrop
The default Cursor to use with a copy operation indicating that a drop is currently not allowed. null if GraphicsEnvironment.isHeadless() returns true.

See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

DefaultMoveNoDrop sample code for java.awt.dnd.DragSource.DefaultMoveNoDrop

public static final Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  DefaultMoveNoDrop
The default Cursor to use with a move operation indicating that a drop is currently not allowed. null if GraphicsEnvironment.isHeadless() returns true.

See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

DefaultLinkNoDrop sample code for java.awt.dnd.DragSource.DefaultLinkNoDrop

public static final Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  DefaultLinkNoDrop
The default Cursor to use with a link operation indicating that a drop is currently not allowed. null if GraphicsEnvironment.isHeadless() returns true.

See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()
Constructor Detail

DragSource sample code for java.awt.dnd.DragSource() definition code for java.awt.dnd.DragSource()

public DragSource()
           throws HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException 
Creates a new DragSource.

Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()
Method Detail

getDefaultDragSource sample code for java.awt.dnd.DragSource.getDefaultDragSource() definition code for java.awt.dnd.DragSource.getDefaultDragSource()

public static DragSource sample code for java.awt.dnd.DragSource definition code for java.awt.dnd.DragSource  getDefaultDragSource()
Gets the DragSource object associated with the underlying platform.

Returns:
the platform DragSource
Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

isDragImageSupported sample code for java.awt.dnd.DragSource.isDragImageSupported() definition code for java.awt.dnd.DragSource.isDragImageSupported()

public static boolean isDragImageSupported()
Reports whether or not drag Image support is available on the underlying platform.

Returns:
if the Drag Image support is available on this platform

startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)

public void startDrag(DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger,
                      Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor,
                      Image sample code for java.awt.Image definition code for java.awt.Image  dragImage,
                      Point sample code for java.awt.Point definition code for java.awt.Point  imageOffset,
                      Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable,
                      DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl,
                      FlavorMap sample code for java.awt.datatransfer.FlavorMap definition code for java.awt.datatransfer.FlavorMap  flavorMap)
               throws InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException 
Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Image to drag, the offset of the Image origin from the hotspot of the Cursor at the instant of the trigger, the Transferable subject data of the drag, the DragSourceListener, and the FlavorMap.

Parameters:
trigger - the DragGestureEvent 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

Throws:
java.awt.dnd.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 sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException

startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)

public void startDrag(DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger,
                      Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor,
                      Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable,
                      DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl,
                      FlavorMap sample code for java.awt.datatransfer.FlavorMap definition code for java.awt.datatransfer.FlavorMap  flavorMap)
               throws InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException 
Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Transferable subject data of the drag, the DragSourceListener, and the FlavorMap.

Parameters:
trigger - the DragGestureEvent that initiated the drag
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

Throws:
java.awt.dnd.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 sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException

startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener)

public void startDrag(DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger,
                      Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor,
                      Image sample code for java.awt.Image definition code for java.awt.Image  dragImage,
                      Point sample code for java.awt.Point definition code for java.awt.Point  dragOffset,
                      Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable,
                      DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
               throws InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException 
Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Image to drag, the offset of the Image origin from the hotspot of the Cursor at the instant of the trigger, the subject data of the drag, and the DragSourceListener.

Parameters:
trigger - the DragGestureEvent that initiated the drag
dragCursor - the initial Cursor or null for defaults
dragImage - the Image to drag or null
dragOffset - 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

Throws:
java.awt.dnd.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 sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException

startDrag sample code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener)

public void startDrag(DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  trigger,
                      Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor,
                      Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  transferable,
                      DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
               throws InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException 
Start a drag, given the DragGestureEvent that initiated the drag, the initial Cursor to use, the Transferable subject data of the drag, and the DragSourceListener.

Parameters:
trigger - the DragGestureEvent that initiated the drag
dragCursor - the initial Cursor or null for defaults
transferable - the subject data of the drag
dsl - the DragSourceListener

Throws:
java.awt.dnd.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 sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException

createDragSourceContext sample code for java.awt.dnd.DragSource.createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer, java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer, java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener)

protected DragSourceContext sample code for java.awt.dnd.DragSourceContext definition code for java.awt.dnd.DragSourceContext  createDragSourceContext(DragSourceContextPeer sample code for java.awt.dnd.peer.DragSourceContextPeer definition code for java.awt.dnd.peer.DragSourceContextPeer  dscp,
                                                    DragGestureEvent sample code for java.awt.dnd.DragGestureEvent definition code for java.awt.dnd.DragGestureEvent  dgl,
                                                    Cursor sample code for java.awt.Cursor definition code for java.awt.Cursor  dragCursor,
                                                    Image sample code for java.awt.Image definition code for java.awt.Image  dragImage,
                                                    Point sample code for java.awt.Point definition code for java.awt.Point  imageOffset,
                                                    Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  t,
                                                    DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
Creates the DragSourceContext to handle this drag.

To incorporate a new DragSourceContext subclass, subclass DragSource and override this method.

If dragImage is null, no image is used to represent the drag over feedback for this drag operation, but NullPointerException is not thrown.

If dsl is null, no drag source listener is registered with the created DragSourceContext, but NullPointerException is not thrown.

If dragCursor is null, the default drag cursors are used for this drag operation. NullPointerException is not thrown.

Parameters:
dscp - The DragSourceContextPeer for this drag
dgl - The DragGestureEvent that triggered the drag
dragCursor - The initial Cursor to display
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
t - The subject data of the drag
dsl - The DragSourceListener
Returns:
the DragSourceContext
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dscp is null
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dgl is null
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if dragImage is not null and imageOffset is null
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if t is null
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the Component associated with the trigger event is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the DragSource for the trigger event is null.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the drag action for the trigger event is DnDConstants.ACTION_NONE.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the source actions for the DragGestureRecognizer associated with the trigger event are equal to DnDConstants.ACTION_NONE.

getFlavorMap sample code for java.awt.dnd.DragSource.getFlavorMap() definition code for java.awt.dnd.DragSource.getFlavorMap()

public FlavorMap sample code for java.awt.datatransfer.FlavorMap definition code for java.awt.datatransfer.FlavorMap  getFlavorMap()
This method returns the FlavorMap for this DragSource.

Returns:
the FlavorMap for this DragSource

createDragGestureRecognizer sample code for java.awt.dnd.DragSource.<T extends java.awt.dnd.DragGestureRecognizer>createDragGestureRecognizer(java.lang.Class<T>, java.awt.Component, int, java.awt.dnd.DragGestureListener) definition code for java.awt.dnd.DragSource.<T extends java.awt.dnd.DragGestureRecognizer>createDragGestureRecognizer(java.lang.Class<T>, java.awt.Component, int, java.awt.dnd.DragGestureListener)

public <T extends DragGestureRecognizer sample code for java.awt.dnd.DragGestureRecognizer definition code for java.awt.dnd.DragGestureRecognizer > T createDragGestureRecognizer(Class sample code for java.lang.Class definition code for java.lang.Class <T> recognizerAbstractClass,
                                                                       Component sample code for java.awt.Component definition code for java.awt.Component  c,
                                                                       int actions,
                                                                       DragGestureListener sample code for java.awt.dnd.DragGestureListener definition code for java.awt.dnd.DragGestureListener  dgl)
Creates a new DragGestureRecognizer 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 if the Toolkit.createDragGestureRecognizer method has no implementation available for the requested DragGestureRecognizer subclass and returns null

createDefaultDragGestureRecognizer sample code for java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(java.awt.Component, int, java.awt.dnd.DragGestureListener) definition code for java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(java.awt.Component, int, java.awt.dnd.DragGestureListener)

public DragGestureRecognizer sample code for java.awt.dnd.DragGestureRecognizer definition code for java.awt.dnd.DragGestureRecognizer  createDefaultDragGestureRecognizer(Component sample code for java.awt.Component definition code for java.awt.Component  c,
                                                                int actions,
                                                                DragGestureListener sample code for java.awt.dnd.DragGestureListener definition code for java.awt.dnd.DragGestureListener  dgl)
Creates a new DragGestureRecognizer 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 default 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 if the Toolkit.createDragGestureRecognizer method has no implementation available for the requested DragGestureRecognizer subclass and returns null

addDragSourceListener sample code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener)

public void addDragSourceListener(DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
Adds the specified DragSourceListener to this DragSource to receive drag source events during drag operations intiated with this DragSource. If a null listener is specified, no action is taken and no exception is thrown.

Parameters:
dsl - the DragSourceListener to add
Since:
1.4
See Also:
removeDragSourceListener(java.awt.dnd.DragSourceListener) sample code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener) , getDragSourceListeners() sample code for java.awt.dnd.DragSource.getDragSourceListeners() definition code for java.awt.dnd.DragSource.getDragSourceListeners()

removeDragSourceListener sample code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener)

public void removeDragSourceListener(DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener  dsl)
Removes the specified DragSourceListener from this DragSource. If a null listener is specified, no action is taken and no exception is thrown. If the listener specified by the argument was not previously added to this DragSource, no action is taken and no exception is thrown.

Parameters:
dsl - the DragSourceListener to remove
Since:
1.4
See Also:
addDragSourceListener(java.awt.dnd.DragSourceListener) sample code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) , getDragSourceListeners() sample code for java.awt.dnd.DragSource.getDragSourceListeners() definition code for java.awt.dnd.DragSource.getDragSourceListeners()

getDragSourceListeners sample code for java.awt.dnd.DragSource.getDragSourceListeners() definition code for java.awt.dnd.DragSource.getDragSourceListeners()

public DragSourceListener sample code for java.awt.dnd.DragSourceListener definition code for java.awt.dnd.DragSourceListener [] getDragSourceListeners()
Gets all the DragSourceListeners registered with this DragSource.

Returns:
all of this DragSource's DragSourceListeners or an empty array if no such listeners are currently registered
Since:
1.4
See Also:
addDragSourceListener(java.awt.dnd.DragSourceListener) sample code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.addDragSourceListener(java.awt.dnd.DragSourceListener) , removeDragSourceListener(java.awt.dnd.DragSourceListener) sample code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener) definition code for java.awt.dnd.DragSource.removeDragSourceListener(java.awt.dnd.DragSourceListener)

addDragSourceMotionListener sample code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener)

public void addDragSourceMotionListener(DragSourceMotionListener sample code for java.awt.dnd.DragSourceMotionListener definition code for java.awt.dnd.DragSourceMotionListener  dsml)
Adds the specified DragSourceMotionListener to this DragSource to receive drag motion events during drag operations intiated with this DragSource. If a null listener is specified, no action is taken and no exception is thrown.

Parameters:
dsml - the DragSourceMotionListener to add
Since:
1.4
See Also:
removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) sample code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) , getDragSourceMotionListeners() sample code for java.awt.dnd.DragSource.getDragSourceMotionListeners() definition code for java.awt.dnd.DragSource.getDragSourceMotionListeners()

removeDragSourceMotionListener sample code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener)

public void removeDragSourceMotionListener(DragSourceMotionListener sample code for java.awt.dnd.DragSourceMotionListener definition code for java.awt.dnd.DragSourceMotionListener  dsml)
Removes the specified DragSourceMotionListener from this DragSource. If a null listener is specified, no action is taken and no exception is thrown. If the listener specified by the argument was not previously added to this DragSource, no action is taken and no exception is thrown.

Parameters:
dsml - the DragSourceMotionListener to remove
Since:
1.4
See Also:
addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) sample code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) , getDragSourceMotionListeners() sample code for java.awt.dnd.DragSource.getDragSourceMotionListeners() definition code for java.awt.dnd.DragSource.getDragSourceMotionListeners()

getDragSourceMotionListeners sample code for java.awt.dnd.DragSource.getDragSourceMotionListeners() definition code for java.awt.dnd.DragSource.getDragSourceMotionListeners()

public DragSourceMotionListener sample code for java.awt.dnd.DragSourceMotionListener definition code for java.awt.dnd.DragSourceMotionListener [] getDragSourceMotionListeners()
Gets all of the DragSourceMotionListeners registered with this DragSource.

Returns:
all of this DragSource's DragSourceMotionListeners or an empty array if no such listeners are currently registered
Since:
1.4
See Also:
addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) sample code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) , removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) sample code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener) definition code for java.awt.dnd.DragSource.removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener)

getListeners sample code for java.awt.dnd.DragSource.<T extends java.util.EventListener>getListeners(java.lang.Class<T>) definition code for java.awt.dnd.DragSource.<T extends java.util.EventListener>getListeners(java.lang.Class<T>)

public <T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener > T[] getListeners(Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
Gets all the objects currently registered as FooListeners upon this DragSource. FooListeners are registered using the addFooListener method.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this DragSource, or an empty array if no such listeners have been added
Throws:
ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.4
See Also:
getDragSourceListeners() sample code for java.awt.dnd.DragSource.getDragSourceListeners() definition code for java.awt.dnd.DragSource.getDragSourceListeners() , getDragSourceMotionListeners() sample code for java.awt.dnd.DragSource.getDragSourceMotionListeners() definition code for java.awt.dnd.DragSource.getDragSourceMotionListeners()

getDragThreshold sample code for java.awt.dnd.DragSource.getDragThreshold() definition code for java.awt.dnd.DragSource.getDragThreshold()

public static int getDragThreshold()
Returns the drag gesture motion threshold. The drag gesture motion threshold defines the recommended behavior for MouseDragGestureRecognizer sample code for java.awt.dnd.MouseDragGestureRecognizer definition code for java.awt.dnd.MouseDragGestureRecognizer s.

If the system property awt.dnd.drag.threshold is set to a positive integer, this method returns the value of the system property; otherwise if a pertinent desktop property is available and supported by the implementation of the Java platform, this method returns the value of that property; otherwise this method returns some default value. The pertinent desktop property can be queried using java.awt.Toolkit.getDesktopProperty("DnD.gestureMotionThreshold").

Returns:
the drag gesture motion threshold
Since:
1.5
See Also:
MouseDragGestureRecognizer sample code for java.awt.dnd.MouseDragGestureRecognizer definition code for java.awt.dnd.MouseDragGestureRecognizer