java.lang.Object | +--java.awt.dnd.DragSource
Unsafe:
static Cursor
DefaultCopyDrop
Cursor to use with a copy operation indicating
that a drop is currently allowed.
static Cursor
DefaultCopyNoDrop
Cursor to use with a copy operation indicating
that a drop is currently not allowed.
static Cursor
DefaultLinkDrop
Cursor to use with a link operation indicating
that a drop is currently allowed.
static Cursor
DefaultLinkNoDrop
Cursor to use with a link operation indicating
that a drop is currently not allowed.
static Cursor
DefaultMoveDrop
Cursor to use with a move operation indicating
that a drop is currently allowed.
static Cursor
DefaultMoveNoDrop
Cursor to use with a move operation indicating
that a drop is currently not allowed.
void
addDragSourceListener(DragSourceListener dsl)
DragSourceListener to this
DragSource to receive drag source events during drag
operations intiated with this DragSource.
void
addDragSourceMotionListener(DragSourceMotionListener dsml)
DragSourceMotionListener to this
DragSource to receive drag motion events during drag
operations intiated with this DragSource.
DragGestureRecognizer
createDefaultDragGestureRecognizer(Component c,
int actions,
DragGestureListener dgl)
DragGestureRecognizer
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)
DragGestureRecognizer
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)
DragSourceContext to handle this drag.
static DragSource
getDefaultDragSource()
DragSource object associated with
the underlying platform.
DragSourceListener[]
getDragSourceListeners()
DragSourceListeners
registered with this DragSource.
DragSourceMotionListener[]
getDragSourceMotionListeners()
DragSourceMotionListeners
registered with this DragSource.
EventListener[]
getListeners(Class listenerType)
FooListeners upon this DragSource.
static boolean
isDragImageSupported()
Image support
is available on the underlying platform.
(package private) void
processDragDropEnd(DragSourceDropEvent dsde)
dragDropEnd on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDropEvent.
(package private) void
processDragEnter(DragSourceDragEvent dsde)
dragEnter on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
(package private) void
processDragExit(DragSourceEvent dse)
dragExit on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceEvent.
(package private) void
processDragMouseMoved(DragSourceDragEvent dsde)
dragMouseMoved on the
DragSourceMotionListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
(package private) void
processDragOver(DragSourceDragEvent dsde)
dragOver on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
(package private) void
processDropActionChanged(DragSourceDragEvent dsde)
dropActionChanged on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
void
removeDragSourceListener(DragSourceListener dsl)
DragSourceListener from this
DragSource.
void
removeDragSourceMotionListener(DragSourceMotionListener dsml)
DragSourceMotionListener from this
DragSource.
void
startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point dragOffset,
Transferable transferable,
DragSourceListener dsl)
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(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap)
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(DragGestureEvent trigger,
Cursor dragCursor,
Transferable transferable,
DragSourceListener dsl)
DragGestureEvent
that initiated the drag, the initial
Cursor to
use,
the Transferable subject data
of the drag, and the DragSourceListener.
void
startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap)
DragGestureEvent
that initiated the drag, the initial
Cursor to use,
the Transferable subject data
of the drag, the DragSourceListener,
and the FlavorMap.
private static final long serialVersionUID
public static final Cursor DefaultCopyDrop
Cursor to use with a copy operation indicating
that a drop is currently allowed. null if
GraphicsEnvironment.isHeadless() returns true.
java.awt.GraphicsEnvironment#isHeadlesspublic static final Cursor DefaultMoveDrop
Cursor to use with a move operation indicating
that a drop is currently allowed. null if
GraphicsEnvironment.isHeadless() returns true.
java.awt.GraphicsEnvironment#isHeadlesspublic static final Cursor DefaultLinkDrop
Cursor to use with a link operation indicating
that a drop is currently allowed. null if
GraphicsEnvironment.isHeadless() returns true.
java.awt.GraphicsEnvironment#isHeadlesspublic static final Cursor DefaultCopyNoDrop
Cursor to use with a copy operation indicating
that a drop is currently not allowed. null if
GraphicsEnvironment.isHeadless() returns true.
java.awt.GraphicsEnvironment#isHeadlesspublic static final Cursor DefaultMoveNoDrop
Cursor to use with a move operation indicating
that a drop is currently not allowed. null if
GraphicsEnvironment.isHeadless() returns true.
java.awt.GraphicsEnvironment#isHeadlesspublic static final Cursor DefaultLinkNoDrop
Cursor to use with a link operation indicating
that a drop is currently not allowed. null if
GraphicsEnvironment.isHeadless() returns true.
java.awt.GraphicsEnvironment#isHeadlessprivate static final DragSource dflt
static final String dragSourceListenerK
static final String dragSourceMotionListenerK
private transient FlavorMap flavorMap
private transient DragSourceListener listener
private transient DragSourceMotionListener motionListener
public DragSource() throws HeadlessException
DragSource.
java.awt.GraphicsEnvironment#isHeadlessprivate static Cursor load(String name)
public static DragSource getDefaultDragSource()
DragSource object associated with
the underlying platform.
java.awt.GraphicsEnvironment#isHeadlesspublic static boolean isDragImageSupported()
Image support
is available on the underlying platform.
public void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl, FlavorMap flavorMap) throws InvalidDnDOperationException
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.
trigger - the DragGestureEvent that initiated the dragdragCursor - the initial Cursor or null for defaultsdragImage - the image to drag or null,imageOffset - the offset of the Image origin from the hotspot
of the Cursor at the instant of the triggertransferable - the subject data of the dragdsl - the DragSourceListenerflavorMap - the FlavorMap to use, or null
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
InvalidDnDOperationExceptionpublic void startDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable transferable, DragSourceListener dsl, FlavorMap flavorMap) throws InvalidDnDOperationException
DragGestureEvent
that initiated the drag, the initial
Cursor to use,
the Transferable subject data
of the drag, the DragSourceListener,
and the FlavorMap.
trigger - the DragGestureEvent that
initiated the dragdragCursor - the initial Cursor or
null for defaultstransferable - the subject data of the dragdsl - the DragSourceListenerflavorMap - 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
InvalidDnDOperationExceptionpublic void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point dragOffset, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
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.
trigger - the DragGestureEvent that initiated the dragdragCursor - the initial Cursor or null for defaultsdragImage - the Image to drag or nulltransferable - the subject data of the dragdsl - the DragSourceListener
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
InvalidDnDOperationExceptionpublic void startDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
DragGestureEvent
that initiated the drag, the initial
Cursor to
use,
the Transferable subject data
of the drag, and the DragSourceListener.
trigger - the DragGestureEvent that initiated the dragdragCursor - the initial Cursor or null for defaultstransferable - the subject data of the dragdsl - the DragSourceListener
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
InvalidDnDOperationExceptionprotected DragSourceContext createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp, DragGestureEvent dgl, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable t, DragSourceListener dsl)
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.
dscp - The DragSourceContextPeer for this dragdgl - The DragGestureEvent that triggered the
dragdragCursor - The initial Cursor to displaydragImage - The Image to drag or nullimageOffset - The offset of the Image origin from the
hotspot of the cursor at the instant of the triggert - The subject data of the dragdsl - The DragSourceListener
DragSourceContext
NullPointerException - if dscp is null
NullPointerException - if dgl is null
NullPointerException - if dragImage is not
null and imageOffset is null
NullPointerException - if t is null
IllegalArgumentException - if the Component
associated with the trigger event is null.
IllegalArgumentException - if the DragSource for the
trigger event is null.
IllegalArgumentException - if the drag action for the
trigger event is DnDConstants.ACTION_NONE.
IllegalArgumentException - if the source actions for the
DragGestureRecognizer associated with the trigger
event are equal to DnDConstants.ACTION_NONE.public FlavorMap getFlavorMap()
FlavorMap for this DragSource.
FlavorMap for this DragSourcepublic DragGestureRecognizer createDragGestureRecognizer(Class recognizerAbstractClass, Component c, int actions, DragGestureListener dgl)
DragGestureRecognizer
that implements the specified
abstract subclass of
DragGestureRecognizer, and
sets the specified Component
and DragGestureListener on
the newly created object.
recognizerAbstractClass - the requested abstract typeactions - the permitted source drag actionsc - the Component targetdgl - the DragGestureListener to notify
DragGestureRecognizer or null
if the Toolkit.createDragGestureRecognizer method
has no implementation available for
the requested DragGestureRecognizer
subclass and returns nullpublic DragGestureRecognizer createDefaultDragGestureRecognizer(Component c, int actions, DragGestureListener dgl)
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.
c - the Component target for the recognizeractions - the permitted source actionsdgl - the DragGestureListener to notify
DragGestureRecognizer or null
if the Toolkit.createDragGestureRecognizer method
has no implementation available for
the requested DragGestureRecognizer
subclass and returns nullpublic void addDragSourceListener(DragSourceListener dsl)
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.
dsl - the DragSourceListener to addremoveDragSourceListener(java.awt.dnd.DragSourceListener),
getDragSourceListeners()public void removeDragSourceListener(DragSourceListener dsl)
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.
dsl - the DragSourceListener to removeaddDragSourceListener(java.awt.dnd.DragSourceListener),
getDragSourceListeners()public DragSourceListener[] getDragSourceListeners()
DragSourceListeners
registered with this DragSource.
DragSource's
DragSourceListeners or an empty array if no
such listeners are currently registeredaddDragSourceListener(java.awt.dnd.DragSourceListener),
removeDragSourceListener(java.awt.dnd.DragSourceListener)public void addDragSourceMotionListener(DragSourceMotionListener dsml)
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.
public void removeDragSourceMotionListener(DragSourceMotionListener dsml)
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.
dsml - the DragSourceMotionListener to removeaddDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener),
getDragSourceMotionListeners()public DragSourceMotionListener[] getDragSourceMotionListeners()
DragSourceMotionListeners
registered with this DragSource.
DragSource's
DragSourceMotionListeners or an empty array if no
such listeners are currently registeredaddDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener),
removeDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener)public EventListener[] getListeners(Class listenerType)
FooListeners upon this DragSource.
FooListeners are registered using the
addFooListener method.
listenerType - the type of listeners requested; this parameter
should specify an interface that descends from
java.util.EventListener
FooListeners on this
DragSource, or an empty array if no such listeners
have been addedgetDragSourceListeners(),
getDragSourceMotionListeners()void processDragEnter(DragSourceDragEvent dsde)
dragEnter on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
dsde - the DragSourceDragEventvoid processDragOver(DragSourceDragEvent dsde)
dragOver on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
dsde - the DragSourceDragEventvoid processDropActionChanged(DragSourceDragEvent dsde)
dropActionChanged on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
dsde - the DragSourceDragEventvoid processDragExit(DragSourceEvent dse)
dragExit on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceEvent.
dse - the DragSourceEventvoid processDragDropEnd(DragSourceDropEvent dsde)
dragDropEnd on the
DragSourceListeners registered with this
DragSource, and passes them the specified
DragSourceDropEvent.
dsde - the DragSourceEventvoid processDragMouseMoved(DragSourceDragEvent dsde)
dragMouseMoved on the
DragSourceMotionListeners registered with this
DragSource, and passes them the specified
DragSourceDragEvent.
dsde - the DragSourceEventprivate void writeObject(ObjectOutputStream s) throws IOException
DragSource. This method first performs
default serialization. Next, it writes out this object's
FlavorMap if and only if it can be serialized. If not,
null is written instead. Next, it writes out
Serializable listeners registered with this
object. Listeners are written in a null-terminated sequence
of 0 or more pairs. The pair consists of a String and an
Object; the String indicates the type of the
Object and is one of the following:
dragSourceListenerK indicating a
DragSourceListener object;
dragSourceMotionListenerK indicating a
DragSourceMotionListener object.
IOExceptionprivate void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException
DragSource. This method first performs
default deserialization. Next, this object's FlavorMap is
deserialized by using the next object in the stream.
If the resulting FlavorMap is null, this
object's FlavorMap is set to the default FlavorMap for
this thread's ClassLoader.
Next, this object's listeners are deserialized by reading a
null-terminated sequence of 0 or more key/value pairs
from the stream:
String equal to
dragSourceListenerK, a DragSourceListener is
deserialized using the corresponding value object and added to this
DragSource.
String equal to
dragSourceMotionListenerK, a
DragSourceMotionListener is deserialized using the
corresponding value object and added to this DragSource.
ClassNotFoundException
IOExceptionjava.awt.datatransfer.SystemFlavorMap#getDefaultFlavorMap