|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.dnd.DragSource

public class DragSource


The DragSource is the entity responsible
for the initiation of the Drag
and Drop operation, and may be used in a number of scenarios:
Component, or application specific
object associated with a Component
instance in the GUI. [implementation dependent]
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.
| Field Summary | |
|---|---|
static Cursor |
DefaultCopyDrop
The default Cursor to use with a copy operation indicating
that a drop is currently allowed. |
static Cursor |
DefaultCopyNoDrop
The default Cursor to use with a copy operation indicating
that a drop is currently not allowed. |
static Cursor |
DefaultLinkDrop
The default Cursor to use with a link operation indicating
that a drop is currently allowed. |
static Cursor |
DefaultLinkNoDrop
The default Cursor to use with a link operation indicating
that a drop is currently not allowed. |
static Cursor |
DefaultMoveDrop
The default Cursor to use with a move operation indicating
that a drop is currently allowed. |
static Cursor |
DefaultMoveNoDrop
The default Cursor to use with a move operation indicating
that a drop is currently not allowed. |
| Constructor Summary | |
|---|---|
DragSource
Creates a new DragSource. |
|
| Method Summary | ||
|---|---|---|
void |
addDragSourceListener
Adds the specified DragSourceListener to this
DragSource to receive drag source events during drag
operations intiated with this DragSource. |
|
void |
addDragSourceMotionListener
Adds the specified DragSourceMotionListener to this
DragSource to receive drag motion events during drag
operations intiated with this DragSource. |
|
DragGestureRecognizer |
createDefaultDragGestureRecognizer
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. |
|
|
createDragGestureRecognizer
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 |
createDragSourceContext
Creates the DragSourceContext to handle this drag. |
|
static DragSource |
getDefaultDragSource
Gets the DragSource object associated with
the underlying platform. |
|
DragSourceListener |
getDragSourceListeners
Gets all the DragSourceListeners
registered with this DragSource. |
|
DragSourceMotionListener |
getDragSourceMotionListeners
Gets all of the DragSourceMotionListeners
registered with this DragSource. |
|
static int |
getDragThreshold
Returns the drag gesture motion threshold. |
|
FlavorMap |
getFlavorMap
This method returns the FlavorMap for this DragSource. |
|
|
getListeners
Gets all the objects currently registered as FooListeners upon this DragSource. |
|
static boolean |
isDragImageSupported
Reports whether or not drag Image support
is available on the underlying platform. |
|
void |
removeDragSourceListener
Removes the specified DragSourceListener from this
DragSource. |
|
void |
removeDragSourceMotionListener
Removes the specified DragSourceMotionListener from this
DragSource. |
|
void |
startDrag
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
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
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
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 ![]() |
|---|
clone |
| Field Detail |
|---|

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.
GraphicsEnvironment.isHeadless()


public static final Cursor![]()
![]()
DefaultMoveDrop
Cursor to use with a move operation indicating
that a drop is currently allowed. null if
GraphicsEnvironment.isHeadless() returns true.
GraphicsEnvironment.isHeadless()


public static final Cursor![]()
![]()
DefaultLinkDrop
Cursor to use with a link operation indicating
that a drop is currently allowed. null if
GraphicsEnvironment.isHeadless() returns true.
GraphicsEnvironment.isHeadless()


public 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.
GraphicsEnvironment.isHeadless()


public 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.
GraphicsEnvironment.isHeadless()


public 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.
GraphicsEnvironment.isHeadless()

| Constructor Detail |
|---|

public DragSource()
throws HeadlessException

DragSource.
HeadlessException

- if GraphicsEnvironment.isHeadless()
returns trueGraphicsEnvironment.isHeadless()

| Method Detail |
|---|

public static DragSource![]()
![]()
getDefaultDragSource()
DragSource object associated with
the underlying platform.
HeadlessException

- if GraphicsEnvironment.isHeadless()
returns trueGraphicsEnvironment.isHeadless()


public 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
InvalidDnDOperationException


public 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
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


public 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 nulldragOffset - the offset of the Image origin from the hotspot
of the