|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagejava.awt.dnd
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
During DnD operations it is possible that a user may wish to drop the subject of the operation on a region of a scrollable GUI control that is not currently visible to the user.In such situations it is desirable that the GUI control detect this and institute a scroll operation in order to make obscured region(s) visible to the user. This feature is known as autoscrolling.
If a GUI control is both an active
DropTarget
and is also scrollable it can receive notifications of autoscrolling gestures by the user from the DnD system by implementing this interface.An autoscrolling gesture is initiated by the user by keeping the drag cursor motionless with a border region of the
Component
referred to as the "autoscrolling region" for a predefined period of time this will result in repeated scroll requests to theComponent
until the dragCursor
resumes its motion. @version 1.10 0211 12/0203/0001 @since 1.2
This class contains constant values representing the type of action(s) to be performed by a Drag and Drop operation. @version 1.16 0217 12/0203/0001 @since 1.2
AClass DragGestureEvent, Component getComponent()DragGestureEvent
is passed toDragGestureListener
's dragGestureRecognized() method when a particularDragGestureRecognizer
detects that a platform dependent drag initiating gesture has occurred on theComponent
that it is tracking. @version 1.1520 @see java.awt.dnd.DragGestureRecognizer @see java.awt.dnd.DragGestureListener @see java.awt.dnd.DragSource
Class DragGestureEvent, int getDragAction()ThisReturnsmethod returnstheComponent
associated with thisDragGestureEvent
.@return the Component
Class DragGestureEvent, Point getDragOrigin()ThisReturnsmethod returnsanint
representing the action selected by the user.@return the action selected by the user
Class DragGestureEvent, DragSource getDragSource()ThisReturnsmethod returnsaPoint
in the coordinates of theComponent
over which the drag originated.@return the Point where the drag originated in Component coords.
Class DragGestureEvent, DragGestureRecognizer getSourceAsDragGestureRecognizer()ThisReturnsmethod returnstheDragSource
.@return the
DragSource
Class DragGestureEvent, InputEvent getTriggerEvent()ThisReturnsmethod returnsthe source as aDragGestureRecognizer
.@return the source as a
DragGestureRecognizer
Class DragGestureEvent, Iterator iterator()ThisReturnsmethod returnsthe initial event that triggered the gesture.@
returnsreturn the first "triggering" event in the sequence of the gesture
Class DragGestureEvent, Object[] toArray()ThisReturnsmethod returnsanIterator
for the events comprising the gesture.@return an Iterator for the events comprising the gesture
Class DragGestureEvent, Object[] toArray(Object[])ThisReturnsmethod returnsanObject
array of the events comprising the drag gesture.@return an array of the events comprising the gesture
ThisReturnsmethod returnsan array of the events comprising the drag gesture.@param array the array of
EventObject
sub(types)@return an array of the events comprising the gesture
TheClass DragGestureRecognizer, Component componentDragGestureRecognizer
is an abstract base class for the specification of a platform-dependent listener that can be associated with a particularComponent
in order to identify platform-dependent drag initiating gestures.The appropriate
DragGestureRecognizer
subclass is obtained from theDragSource
asssociated with a particularComponent
or from theToolkit
object via its createDragGestureRecognizer() method.Once the
DragGestureRecognizer
is associated with a particularComponent
it will register the appropriate listener interfaces on thatComponent
in order to track the input events delivered to theComponent
.Once the
DragGestureRecognizer
identifies a sequence of events on theComponent
as a drag initiating gesture it will notify its unicastDragGestureListener
by invoking its gestureRecognized() method.When a concrete
DragGestureRecognizer
instance detects a drag initiating gesture on theComponent
it is associated with it will fire aDragGestureEvent
to theDragGestureListener
registered on its unicast event source forDragGestureListener
events. ThisDragGestureListener
is responsible for causing the associatedDragSource
to start the Drag and Drop operation (if appropriate).@author Laurence P. G. Cable @version 1.
1317 @see java.awt.dnd.DragGestureListener @see java.awt.dnd.DragGestureEvent @see java.awt.dnd.DragSource
TheClass DragGestureRecognizer, DragSource dragSourceComponent
associated with thisDragGestureRecognizer
. @serial
TheClass DragGestureRecognizer, ArrayList eventsDragSource
associated with thisDragGestureRecognizer
. @serial
The list of events (in order) that the DragGestureRecognizer
"recognized" as a "gesture" that triggers a drag. @serial
Class DragGestureRecognizer, int sourceActionsAn int
representing the type(s) of action(s) used in this Drag and Drop operation. @serial
TheClass DragSource, constructor DragSource()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
- 1 default instance per JVM for the lifetime of that JVM.
- 1 instance per class of potential Drag Initiator object (e.g TextField). [implementation dependent]
- 1 per instance of a particular
Component
or application specific object associated with aComponent
instance in the GUI. [implementation dependent]- Some other arbitrary association. [implementation dependent]
DragSource
is obtained aDragGestureRecognizer
should also be obtained to associate theDragSource
with a particularComponent
.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 aDragGestureRecognizer
.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. ADragSource
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 anIllegalDnDOperationException
until such time as the extant operation is complete.The startDrag() method invokes the createDragSourceContext() method to instantiate an appropriate
DragSourceContext
and associate theDragSourceContextPeer
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
. @version 1.30 0237 12/0203/0001 @since 1.2
Construct a new DragSource
. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Class DragSource, DragSource getDefaultDragSource()This method returns theClass DragSource, Cursor DefaultCopyDropDragSource
object associated with the underlying platform.@return the platform DragSource @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
The defaultClass DragSource, Cursor DefaultCopyNoDropCursor
to use with a copy operation indicating that a drop is currently allowed.null
ifGraphicsEnvironment.isHeadless()
returnstrue
. @see java.awt.GraphicsEnvironment#isHeadless
The defaultClass DragSource, Cursor DefaultLinkDropCursor
to use with a copy operation indicating that a drop is currently not allowed.null
ifGraphicsEnvironment.isHeadless()
returnstrue
. @see java.awt.GraphicsEnvironment#isHeadless
The defaultClass DragSource, Cursor DefaultLinkNoDropCursor
to use with a link operation indicating that a drop is currently allowed.null
ifGraphicsEnvironment.isHeadless()
returnstrue
. @see java.awt.GraphicsEnvironment#isHeadless
The defaultClass DragSource, Cursor DefaultMoveDropCursor
to use with a link operation indicating that a drop is currently not allowed.null
ifGraphicsEnvironment.isHeadless()
returnstrue
. @see java.awt.GraphicsEnvironment#isHeadless
The defaultClass DragSource, Cursor DefaultMoveNoDropCursor
to use with a move operation indicating that a drop is currently allowed.null
ifGraphicsEnvironment.isHeadless()
returnstrue
. @see java.awt.GraphicsEnvironment#isHeadless
The defaultCursor
to use with a move operation indicating that a drop is currently not allowed.null
ifGraphicsEnvironment.isHeadless()
returnstrue
. @see java.awt.GraphicsEnvironment#isHeadless
TheClass DragSourceContext, constructor DragSourceContext(DragSourceContextPeer, DragGestureEvent, Cursor, Image, Point, Transferable, DragSourceListener)DragSourceContext
class is responsible for managing the initiator side of the Drag and Drop protocol. In particular it is responsible for managing drag event notifications to theDragSourceListener
s andproviding the Transferable stateDragSourceMotionListener
sto enableand providing thedata transfer. An instance of this class is created as a result of a
DragSource'sTransferablestartDrag() method beingrepresentingsuccessfully invoked. This instancetheis responsiblesource data fortrackingthestate of thedrag operationon behalf of the DragSource and dispatching state changes to the DragSourceListener.Note that the
DragSourceContext
itself implements theDragSourceListener
interfaceandDragSourceMotionListener
interfaces. This is to allow the platform peer (theDragSourceContextPeer
instance) created by theDragSource
to notify theDragSourceContext
ofchanges instate changes in theongiongongoing operation. This allows theDragSourceContext
to interpose itself between the platform and theDragSourceListenerlisteners provided by the initiator of the drag operation. @see DragSourceListener @see DragSourceMotionListener @version 1.42 0447 12/3003/01 @since 1.2
Called fromClass DragSourceContext, void dragDropEnd(DragSourceDropEvent)DragSource
this constructor creates a newDragSourceContext
given theDragSourceContextPeer
for this Drag theDragGestureEvent
that triggered the Drag the initialCursor
to use for the Drag an (optional)Image
to display while the Drag is taking place the offset of theImage
origin from the hotspot at the instant of the triggering event theTransferable
subject data and theDragSourceListener
to use during the Drag and Drop operation.
IfDragSourceContextPeer
isnull
NullPointerException
is thrown.
IfDragGestureEvent
isnull
NullPointerException
is thrown.
IfCursor
isnull
no exception is thrown and default drag cursors are used for this drag operation.
IfImage
isnull
no exception is thrown.
IfImage
is notnull
and the offset isnull
NullPointerException
is thrown.
IfTransferable
isnull
NullPointerException
is thrown.
IfDragSourceListener
isnull
no exception is thrown. @param dscp theDragSourceContextPeer
for this drag @param trigger the triggering event @param dragCursor the initialCursor
@param dragImage theImage
to drag (ornull
) @param offset the offset of the image origin from the hotspot at the instant of the triggering event @param t theTransferable
@param dsl theDragSourceListener
@throws IllegalArgumentException if theComponent
associated with the trigger event isnull
. @throws IllegalArgumentException if theDragSource
for the trigger event isnull
. @throws IllegalArgumentException if the drag action for the triggerinstanceevent isincompleteDnDConstants.ACTION_NONE
. @throws IllegalArgumentException if the source actions for theDragGestureRecognizer
associated with the trigger event are equal toDnDConstants.ACTION_NONE
. @throws NullPointerException if dscpdsltrigger or t are null or if dragImage is non-null and offset is null
This methodClass DragSourceContext, void dragEnter(DragSourceDragEvent)interceptscallsthe
DragSourceDropEvent associated withdragDropEnd()fromon thepeer. Note: This method isDragSourceListener
scalled by theregistered with thispeerDragSourceContext
implementation notand with theuser. The value ofassociated
nullDragSourceis notandacceptable aspasses thema parameter tothethisspecifiedmethodDragSourceDropEvent
.@param dsde theinterceptedDragSourceDropEvent
This methodClass DragSourceContext, void dragExit(DragSourceEvent)interceptscallsdragEnter
on thes
DragSourceDragEventDragSourceListenerassociatedregistered withdragEnter() fromthistheDragSourceContext
peer.and withNote:theThisassociatedmethodDragSource
is called byand passes them thepeer implementation notspecifiedthe userDragSourceDragEvent
.@param dsde theinterceptedDragSourceDragEvent
This methodClass DragSourceContext, void dragOver(DragSourceDragEvent)interceptscallsdragExit
on thes
DragSourceEventDragSourceListenerassociatedregistered withdragExit() fromthistheDragSourceContext
peer.and withNote:theThisassociatedmethodDragSource
is called byand passes them thepeer implementation notspecifiedthe userDragSourceEvent
.@paramdsedsde theinterceptedDragSourceEvent
This methodClass DragSourceContext, void dropActionChanged(DragSourceDragEvent)interceptscallsdragOver
on thes
DragSourceDragEventDragSourceListenerassociatedregistered withdragOver() fromthistheDragSourceContext
peer.and withNote:theThisassociatedmethodDragSource
is called byand passes them thepeer implementation notspecifiedthe userDragSourceDragEvent
.@param dsde theinterceptedDragSourceDragEvent
This methodClass DragSourceContext, int getSourceActions()interceptscallsdropActionChanged
on thes
DragSourceDragEventDragSourceListenerassociatedregistered withdropActionChanged() fromthistheDragSourceContext
peer.and withNote:theThisassociatedmethodDragSource
is called byand passes them thepeer implementation notspecifiedthe userDragSourceDragEvent
.@param dsde theinterceptedDragSourceDragEvent
This method returnsClass DragSourceContext, Transferable getTransferable()ana bitwise mask of
intDnDConstantsrepresentingthat represents the set of drop actions supported by the drag source for thecurrentdragaction(s)operation associated with thisDragSourceContext
.. @return thecurrentdrop actions supported by the drag source
This method returns theTransferable
associated with thisDragSourceContext
..@return the
Transferable
TheClass DragSourceDragEvent, constructor DragSourceDragEvent(DragSourceContext, int, int, int)DragSourceDragEvent
is delivered from theDragSourceContextPeer
via theDragSourceContext
to thecurrentlyDragSourceListener
registered with thatand with its associated
DragSourceListenerDragSourceContextDragSource
.It containsThe
stateDragSourceDragEvent
reports the target drop action andregardingthe user drop action that reflect the current state of the drag operation.toTarget drop action is one of
DnDConstants
thatenablerepresents theoperationsdropinitiatoractiontoselected by the current drop target if this drop action is supported by the drag source orprovideDnDConstants.ACTION_NONE
if this drop action is not supported by the drag source.User drop action depends on the drop actions supported by the drag source and the drop action selected by the
enduser. The userwithcan select a drop action by pressing modifier keys during the drag operation:Ctrl + Shift -> ACTION_LINK Ctrl -> ACTION_COPY Shift ->ACTION_MOVE If the user selects a drop action the user drop action is one ofDnDConstants
that represents the selected drop action if this drop action is supported by the drag source orDnDConstants.ACTION_NONE
if this drop action is not supported by the drag source.If the user doesn't select a drop action the set of
theDnDConstants
that representsappropriateset of drop actions supported by the dragoversource is searched forDnDConstants.ACTION_MOVE
then forDnDConstants.ACTION_COPY
then forfeedbackDnDConstants.ACTION_LINK
and the user drop action is the first constant found. If no constant is found the user drop action isDnDConstants.ACTION_NONE
. @version 1.20 0225 12/0203/0001 @since 1.2
Constructs aClass DragSourceDragEvent, int getDropAction()DragSourceDragEvent
. This class is typically instantiated by theDragSourceContextPeer
rather than directly by client code. The coordinates for thisDragSourceDragEvent
are not specified sogetLocation
will returnnull
for this event. @param dsc theDragSourceContext
that is to manage notifications for this event. @param dropAction thevalue of one of the staticuserfieldsdropfromaction.DNDConstants@paramindicatingactions thetype of usertarget drop actionthis event represents. @paramactionsmodifiers thevaluemodifierof one of thekeys down during eventstatic(shiftfields fromctrl altDNDConstantsmeta)indicating theEither extendedtype_DOWN_MASKof targetor olddrop_MASKaction supported by and returned from the current dropmodifiers should be used but both models should nottarget.be@parammixedmodifiers specifiesin onetheevent.stateUse of theinput deviceextended modifiersassociated withisthepreferred.user@seegesturejava.awt.event.InputEvent @see DragSourceEvent#getLocation
This method returnsClass DragSourceDragEvent, int getTargetActions()anthe logicalintintersectionrepresentingof theeffectiveuser drop actionwhich istheintersection of the user'stargetselecteddrop action and thesourcesetand targetof drop actions.supported@returnby theeffective drop actiondragwhichsource.is@return the logical intersection of the user'sdrop action the targetselecteddrop action and thesourcesetand targetof drop actions supported by the drag source.
This method returns theClass DragSourceDragEvent, int getUserAction()logical intersection of the currenttargetsource anddropuser actionsaction.@return thelogical intersection of the currenttargetsource anddropuser actionsaction.
This method returnsan int representingthe user's currently selecteddrop action.@return the user's currentlyselecteddrop action.
TheClass DragSourceDropEvent, constructor DragSourceDropEvent(DragSourceContext)DragSourceDropEvent
is delivered from theDragSourceContextPeer
via theDragSourceContext
toitsthecurrentlydragDropEnd
registeredmethod ofDragSourceListener
'sdragDropEnd()registeredmethodwith thatDragSourceContext
and with its associatedDragSource
. It contains sufficient information for the originator of the operation to provide appropriate feedback to the end user when the operation completes.@version 1.
12 0216 12/0203/0001@since 1.2
Construct aClass DragSourceDropEvent, constructor DragSourceDropEvent(DragSourceContext, int, boolean)DragSourceDropEvent
for a drag that does not result in a drop. The coordinates for thisDragSourceDropEvent
are not specified sogetLocation
will returnnull
for this event. @param dsc theDragSourceContext
@see DragSourceEvent#getLocation
Construct aClass DragSourceDropEvent, int getDropAction()DragSourceDropEvent
for a drop given theDragSourceContext
the drop action and aboolean
indicating if the drop was successful. The coordinates for thisDragSourceDropEvent
are not specified sogetLocation
will returnnull
for this event. @param dsc theDragSourceContext
associated with thisDragSourceDropEvent
@param action the drop action @param success a boolean indicating if the drop was successful @see DragSourceEvent#getLocation
This method returns anClass DragSourceDropEvent, boolean getDropSuccess()int
representing the action performed by the target on the subject of the drop.@return the action performed by the target on the subject of the drop if the drop target accepted the drop and the target drop action is supported by the drag source; otherwiseDnDConstants.ACTION_NONE
.
This method returns aboolean
indicating if the drop wasa successsuccessful.@returntrue
if the dropwastargetsuccessfulaccepted the drop and successfully performed a drop action;false
if the drop target rejected the drop or if the drop target accepted the drop but failed to perform a drop action.
This class is the base class forClass DragSourceEvent, constructor DragSourceEvent(DragSourceContext)DragSourceDragEvent
andDragSourceDropEvent
.
DragSourceEvent
s are generated whenever the drag enters moves over or exits a drop site when the drop action changes and when the drag ends. The location for the generatedDragSourceEvent
specifies the mouse cursor location in screen coordinates at the moment this event occured.In a multi-screen environment without a virtual device the cursor location is specified in the coordinate system of the initiator
GraphicsConfiguration
. The initiatorGraphicsConfiguration
is theGraphicsConfiguration
of theComponent
on which the drag gesture for the current drag operation was recognized. If the cursor location is outside the bounds of the initiatorGraphicsConfiguration
the reported coordinates are clipped to fit within the bounds of thatGraphicsConfiguration
.In a multi-screen environment with a virtual device the location is specified in the corresponding virtual coordinate system. If the cursor location is outside the bounds of the virtual device the reported coordinates are clipped to fit within the bounds of the virtual device.
@since 1.2
Construct aDragSourceEvent
given a specifiedDragSourceContext
. The coordinates for thisDragSourceEvent
are not specified sogetLocation
will returnnull
for this event. @param dsc theDragSourceContext
@see #getLocation
TheClass DragSourceListener, void dragDropEnd(DragSourceDropEvent)DragSourceListener
defines the event interface for originators of Drag and Drop operations to track the state of the user's gesture and to provide appropriate "drag over" feedback to the user throughout the Drag and Drop operation. @version 1.15 0217 12/0203/0001 @since 1.2
This method is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theClass DragSourceListener, void dragEnter(DragSourceDragEvent)DragSourceDropEvent
can be used to determine the termination state. The getDropAction() method returns the operation that theDropTarget selected (via the DropTargetDropEventdropacceptDrop()siteparameter)selected to apply to the Drop operation. Once this method is complete the currentDragSourceContext
and associated resources become invalid.@param dsde theDragSourceDropEvent
Called as the cursor's hotspot enters a platformClass DragSourceListener, void dragExit(DragSourceEvent)-dependent drop site. This method is invoked when all the following conditions are true:
- The
logicalcursor's hotspotinitially intersects a GUI Component's visible geometry.entersThattheComponentoperablehas an activepart of aDropTargetplatform-associated with itdependent drop site.- The
DropTarget's registered DropTargetListener dragEnter()dropmethodsite isinvoked and returns successfullyactive.- The
registered DropTargetListener invokes the DropTargetDragEvent's acceptDrag() methoddropto acceptsite accepts the dragbased upon interrogation of the source's potential drop action(s) and available data types (DataFlavors).@param dsde theDragSourceDragEvent
Called as the cursor's hotspot exits a platformClass DragSourceListener, void dragOver(DragSourceDragEvent)-dependent drop site. This method is invoked when any of the following conditions are true:OR
- The cursor's
logicalhotspot no longer intersects thevisible geometryoperable part of theComponentdrop site associated with the previous dragEnter() invocation.OR
- The
Component that the logical cursor's hotspot intersecteddropthat resulted insite associated with the previous dragEnter() invocation is no longerhas anactiveDropTarget or DropTargetListener associated with it.
- The current
DropTarget'sdropDropTargetListenersite hasinvoked rejectDrag() sincerejected thelast dragEnter() or dragOver() invocationdrag.@param dse theDragSourceEvent
Called as the cursor's hotspot moves over a platformClass DragSourceListener, void dropActionChanged(DragSourceDragEvent)-dependent drop site. This method is invoked when all the following conditions are true:
- The cursor's
logicalhotspot has moved but still intersects thevisible geometryoperable part of theComponentdrop site associated with the previous dragEnter() invocation.That Component still has a DropTarget associated with it.TheThatdropDropTargetsite is still active.- The
DropTarget's registered DropTargetListener dragOver() method is invoked and returns successfully. The DropTarget doesdropnot rejectsite accepts the dragvia rejectDrag().@param dsde theDragSourceDragEvent
Called when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.@param dsde theDragSourceDragEvent
TheClass DropTarget, constructor DropTarget()DropTarget
is associated with aComponent
when thatComponent
wishes to accept drops during Drag and Drop operations. @version 1.34 0241 12/0203/0001 @since 1.2
Construct a DropTarget
. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Class DropTarget, constructor DropTarget(Component, DropTargetListener)Construct aClass DropTarget, constructor DropTarget(Component, int, DropTargetListener)DropTarget
given theComponent
to associate itself with and theDropTargetListener
to handle event processing.The Component will receive drops only if it is enabled. @param c The
Component
with which thisDropTarget
is associated @param dtl TheDropTargetListener
for thisDropTarget
@exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Construct aClass DropTarget, constructor DropTarget(Component, int, DropTargetListener, boolean)DropTarget
given theComponent
to associate itself with anint
representing the default acceptable action(s) to support and aDropTargetListener
to handle event processing.The Component will receive drops only if it is enabled. @param c The
Component
with which thisDropTarget
is associated @param ops The default acceptable actions for thisDropTarget
@param dtl TheDropTargetListener
for thisDropTarget
@exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Construct aClass DropTarget, constructor DropTarget(Component, int, DropTargetListener, boolean, FlavorMap)DropTarget
given theComponent
to associate itself with anint
representing the default acceptable action(s) to support aDropTargetListener
to handle event processing and aboolean
indicating if theDropTarget
is currently accepting drops.The Component will receive drops only if it is enabled. @param c The
Component
with which thisDropTarget
is associated @param ops The default acceptable actions for thisDropTarget
@param dtl TheDropTargetListener
for thisDropTarget
@param act Is theDropTarget
accepting drops. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
Construct a new DropTarget given theComponent
to associate itself with anint
representing the default acceptable action(s) to support aDropTargetListener
to handle event processing aboolean
indicating if theDropTarget
is currently accepting drops and aFlavorMap
to use (or null).The Component will receive drops only if it is enabled. @param c The
Component
with which thisDropTarget
is associated @param ops The default acceptable actions for thisDropTarget
@param dtl TheDropTargetListener
for thisDropTarget
@param act Is theDropTarget
accepting drops. @param fm TheFlavorMap
to use or null @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true @see java.awt.GraphicsEnvironment#isHeadless
ADropTargetContext
is created whenever the logical cursor associated with a Drag and Drop operation coincides with the visible geometry of aComponent
associated with aDropTarget
. TheDropTargetContext
provides the mechanism for a potential receiver of a drop operation to both provide the end user with the appropriate drag under feedback but also to effect the subsequent data transfer if appropriate. @version 1.28 0233 12/0203/0001 @since 1.2
Class DropTargetContext.TransferableProxy, Object getTransferData(DataFlavor)TheTransferableProxy
is anestedhelper inner class thatsupportsimplementstheTransferable
interface and serves as a proxy for another
DropTargetContextTransferableinobjectmanaging thewhich represents data transferoffordataa particular drag-n-drop operation.In particular it provides automatic support forThe proxy forwards all requests to the
de-serializationencapsulated transferable and automatically performs additional conversion on the data returned by the encapsulated transferable in case ofapplication/x-java-serialized-objectlocalDatFlavorstransfer.
Class DropTargetContext.TransferableProxy, DataFlavor[] getTransferDataFlavors()getReturns an object which represents thetransferdata provided by the encapsulated transferable for the requested data flavor.@param
dfIn case of local transfer a serialized copy of theDataFlavorobject returned@throwsbyUnsupportedFlavorExceptiontheifencapsulated transferable is provided when the data is requestedDataFlavorinisapplication/x-java-serialized-objectnot supporteddata flavor. @param flavor the requested flavor for the data @throws IOException if the data is no longer available in the requested flavor.@returnthrows UnsupportedFlavorException if theObjectrequested data flavor is not supported.
Class DropTargetContext.TransferableProxy, boolean isDataFlavorSupported(DataFlavor)getReturns an array of DataFlavor objects indicating the flavors the data can be provided in by the encapsulated transferable.@return an array of data flavors in which the
DataFlavordataarraycan be provided by the encapsulated transferable
Class DropTargetContext.TransferableProxy, boolean isLocalcheckReturnsifwhether or not thea particularspecified data flavor is supported by the encapsulated transferable. @param flavor theDataFlavorrequested flavor for the data @returna
booleantrueindicatingif thespecifieddataDataFlavorflavor is supported.false
otherwise
AClass DropTargetContext.TransferableProxy, Transferable transferableindicating if the encapsulated
boolean
DragSourceTransferableisobjectinrepresents thesameresultJVMof local drag-n-dropasoperation (within theDropTargetsame JVM).
The"actual"encapsulatedTransferable
that the Proxy is a Proxy for usually supplied from the underlying systemobject.
subclasses may overrideCreates a TransferableProxythistosupply their own Proxyproxy for the specified Transferable. @param t the Transferable to be proxied @param localbooleantrue if t represents the result of a local drag-n-drop operation. @return theTransferablenew TransferableProxy instance.
TheClass DropTargetDragEvent, constructor DropTargetDragEvent(DropTargetContext, Point, int, int)DropTargetDragEvent
is delivered to aDropTargetListener
via its dragEnter() and dragOver() methods.The
DropTargetDragEvent
reports the source drop actions and the user drop action that reflect the current state of the drag operation.Source drop actions is a bitwise mask of
DnDConstants
that represents the set of drop actions supported by the drag source for this drag operation.User drop action depends on the drop actions supported by the drag source and the drop action selected by the user. The user can select a drop action by pressing modifier keys during the drag operation:
Ctrl + Shift -> ACTION_LINK Ctrl -> ACTION_COPY Shift -> ACTION_MOVEIf the user selects a drop action the user drop action is one ofDnDConstants
that represents the selected drop action if this drop action is supported by the drag source orDnDConstants.ACTION_NONE
if this drop action is not supported by the drag source.If the user doesn't select a drop action the set of
@version 1.DnDConstants
that represents the set of drop actions supported by the drag source is searched forDnDConstants.ACTION_MOVE
then forDnDConstants.ACTION_COPY
then forDnDConstants.ACTION_LINK
and the user drop action is the first constant found. If no constant is found the user drop action isDnDConstants.ACTION_NONE
.16 0220 12/0203/0001 @since 1.2
Construct aClass DropTargetDragEvent, void acceptDrag(int)DropTargetDragEvent
given theDropTargetContext
for this operation the location of the "Drag"Cursor
's hotspot in theComponent
's coordinates thecurrently selecteduser drop action andcurrent set ofthe source drop actionssupported by the source.@param dtc The DropTargetContext for this operation @param cursorLocn The location of the "Drag" Cursor's hotspot in Component coordinates @param dropAction The
currently selecteduser drop action @param srcActions Thecurrent setsourceofdrop actionssupported@throwsby the sourceNullPointerException if cursorLocn is null @throwsNullPointerExceptionIllegalArgumentException
ifcursorLocndropAction isnullnot one ofDnDConstants
. @throwsIllegalArgumentException
ifthe dropAction orsrcActions is notsrcActionsa bitwise maskareofillegalDnDConstants
.values@throwsorIllegalArgumentException
if dtc isnull
.
Class DropTargetDragEvent, int getDropAction()AcceptAccepts the drag. This method should be called from aDropTargetListeners
dragEnter
()dragOver
and()dragActionChanged()dropActionChanged
methods if the implementation wishes to accept an operation from the srcActions other than the one selected by the user as represented by thedropAction
.@param dragOperation the operation accepted by the target
This method returnsClass DropTargetDragEvent, int getSourceActions()an int representingthecurrentlyuserselecteddrop action.@returncurrently selectedthe user drop action
This method returnsClass DropTargetDragEvent, void rejectDrag()an int representingtheset ofsource drop actionssupported by the source.@return the source drop actions
RejectRejects the drag as a result of examining either thedropAction
or the availableDataFlavor
types.
TheClass DropTargetDropEvent, constructor DropTargetDropEvent(DropTargetContext, Point, int, int)DropTargetDropEvent
is delivered via theDropTargetListener
drop() method.The
DropTargetDropEvent
reports the source drop actions and the user drop action that reflect the current state of the drag-and-drop operation.Source drop actions is a bitwise mask of
DnDConstants
that represents the set of drop actions supported by the drag source for this drag-and-drop operation.User drop action depends on the drop actions supported by the drag source and the drop action selected by the user. The user can select a drop action by pressing modifier keys during the drag operation:
Ctrl + Shift -> ACTION_LINK Ctrl -> ACTION_COPY Shift -> ACTION_MOVEIf the user selects a drop action the user drop action is one ofDnDConstants
that represents the selected drop action if this drop action is supported by the drag source orDnDConstants.ACTION_NONE
if this drop action is not supported by the drag source.If the user doesn't select a drop action the set of
@version 1.DnDConstants
that represents the set of drop actions supported by the drag source is searched forDnDConstants.ACTION_MOVE
then forDnDConstants.ACTION_COPY
then forDnDConstants.ACTION_LINK
and the user drop action is the first constant found. If no constant is found the user drop action isDnDConstants.ACTION_NONE
.21 0224 12/0203/0001 @since 1.2
Construct aClass DropTargetDropEvent, constructor DropTargetDropEvent(DropTargetContext, Point, int, int, boolean)DropTargetDropEvent
given theDropTargetContext
for this operation the location of the dragCursor
's hotspot in theComponent
's coordinates the currently selected user drop action and the current set of actions supported by the source. By default this constructor assumes that the target is not in the same virtual machine as the source; that is #isLocalTransfer() will returnfalse
.@param dtc The
DropTargetContext
for this operation @param cursorLocn The location of the "Drag" Cursor's hotspot inComponent
coordinates @param dropActionThe currently selectedthe user drop action: COPY MOVE or LINK constants found in DnDConstants. @param srcActionsThe current set of actions supported bythe source: some combinationof COPY MOVEdroporactions.LINK@throwsasNullPointerException
exposed by theif cursorLocn is
DragSourcenull.@throwsif
NullPointerExceptionIllegalArgumentExceptioncursorLocndropAction is not one of. @throws
nullDnDConstantsIllegalArgumentException
ifthe dropAction orsrcActions is notsrcActionsa bitwise maskareofillegalDnDConstants
.values@throwsorIllegalArgumentException
if dtc isnull
.
Construct aClass DropTargetDropEvent, int getDropAction()DropTargetEvent
given theDropTargetContext
for this operation the location of the dragCursor
's hotspot in theComponent
's coordinates the currently selected user drop action the current set of actions supported by the source and aboolean
indicating if the source is in the same JVM as the target.@param dtc The DropTargetContext for this operation @param cursorLocn The location of the "Drag" Cursor's hotspot in Component's coordinates @param dropAction
The currently selectedthe user drop action: COPY MOVE.or@paramLINK constants found in DnDConstantssrcActions the source drop actions. @paramsrcActionsisLocalTxThe current set of actions supportedTrue if the source is inbythe same JVM as thesource:target @throwsNullPointerException
some combination ofif cursorLocn isCOPYnull
MOVE@throwsorIllegalArgumentException
LINK as exposed byif dropAction is nottheone of. @
DragSourceDnDConstantsparam isLocalTxthrowsTrueIllegalArgumentException
ifthe sourcesrcActions isin the same JVM asnot a bitwise mask oftheDnDConstants
.target@throwsIllegalArgumentException
if dtc isnull
.
This method returnsClass DropTargetDropEvent, int getSourceActions()an int representingtheaction(s) supported byuserthedropsourceaction.at@return thetime of theuser drop.@return sourceactions.
This method returnsan int representingtheaction(s) supported bysourcethe sourcedrop actions.@return the source drop actions.
TheClass DropTargetEvent, DropTargetContext contextDropTargetEvent
is the base class for both theDropTargetDragEvent
and theDropTargetDropEvent
. It encapsulates the current state of the Drag and Drop operations in particular the currentDropTargetContext
. @version 1.14 0216 12/0203/0001 @since 1.2
Theassociated with this
DropTargetConextDropTargetContextDropTargetEvent
. @serial
TheClass DropTargetListener, void dragEnter(DropTargetDragEvent)DropTargetListener
interface is the callback interface used by theDropTarget
class to provide notification of DnD operations that involve the subjectDropTarget
. Methods of this interface may be implemented to provide "drag under" visual feedback to the user throughout the Drag and Drop operation.Create a listener object by implementing the interface and then register it with a
DropTarget
. When the drag enters moves over or exits the operable part of the drop site for thatDropTarget
when the drop action changes and when the drop occurs the relevant method in the listener object is invoked and theDropTargetEvent
is passed to it.The operable part of the drop site for the
@version 1.DropTarget
is the part of the associatedComponent
's geometry that is not obscured by an overlapping top-level window or by anotherComponent
higher in the Z-order that has an associated activeDropTarget
.16 0219 12/0203/0001 @since 1.2
CalledClass DropTargetListener, void dragExit(DropTargetEvent)whenwhile a drag operationhasis ongoing when the mouse pointer enters the operableencounteredpart of the drop site for theDropTarget
.registered with this listener. @param dtde theDropTargetDragEvent
Class DropTargetListener, void dragOver(DropTargetDragEvent)TheCalled while a drag operation is ongoing when the mouse pointer hasdepartedexited the operable part of the drop site for theDropTarget
withoutregistereddropping.with this listener. @param dte theDropTargetEvent
Called when a drag operation is ongoingClass DropTargetListener, void drop(DropTargetDropEvent)onwhile the mouse pointer is still over the operable part of the drop site for theDropTarget
.registered with this listener. @param dtde theDropTargetDragEvent
TheCalled when the drag operation has terminated with a drop onthisthe operable part of the drop site for theDropTarget
registered with this listener.This method is responsible for undertaking the transfer of the data associated with the gesture. The
DropTargetDropEvent
provides a means to obtain aTransferable
object that represents the data object(s) to be transfered.From this method the
DropTargetListener
shall accept or reject the drop via the acceptDrop(int dropAction) or rejectDrop() methods of theDropTargetDropEvent
parameter.Subsequent to acceptDrop() but not before
DropTargetDropEvent
's getTransferable() method may be invoked and data transfer may be performed via the returnedTransferable
's getTransferData() method.At the completion of a drop an implementation of this method is required to signal the success/failure of the drop by passing an appropriate
boolean
to theDropTargetDropEvent
's dropComplete(boolean success) method.Note: The
actualdata transfer should be completed before the call to theDropTargetDropEvent
's dropComplete(boolean success) method. After that a call to the getTransferData()processingmethod of theTransferable
returned byDropTargetDropEvent.getTransferable()
is guaranteed to succeed only if the data transfer isnot requiredlocal;to finish before thisthat is only ifmethodDropTargetDropEvent.isLocalTransfer()
returnstrue
.It mayOtherwise thebebehavior of thedeferred untilcall islaterimplementation-dependent.@param dtde the
DropTargetDropEvent
This exception is thrown by various methods in the java.awt.dnd package. It is usually thrown to indicate that the target in question is unable to undertake the requested operation that the present time since the undrelying DnD system is not in the appropriate state. @version 1.9 0210 12/0203/0001 @since 1.2
This abstract subclass ofDragGestureRecognizer
defines aDragGestureRecognizer
for mouse based gestures. Each platform will implement its own concrete subclass of this class available via the Toolkit.createDragGestureRecognizer() method to encapsulate the recognition of the platform dependent mouse gesture(s) that initiate a Drag and Drop operation. @author Laurence P. G. Cable @version 1.911 @see java.awt.dnd.DragGestureListener @see java.awt.dnd.DragGestureEvent @see java.awt.dnd.DragSource