Package java.awt.dnd
See: Description
-
Interface Summary Interface Description Autoscroll 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.DragGestureListener The listener interface for receiving drag gesture events.DragSourceListener TheDragSourceListener
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.DragSourceMotionListener A listener interface for receiving mouse motion events during a drag operation.DropTargetListener TheDropTargetListener
interface is the callback interface used by theDropTarget
class to provide notification of DnD operations that involve the subjectDropTarget
. -
Class Summary Class Description DnDConstants This class contains constant values representing the type of action(s) to be performed by a Drag and Drop operation.DragGestureEvent ADragGestureEvent
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.DragGestureRecognizer TheDragGestureRecognizer
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.DragSource TheDragSource
is the entity responsible for the initiation of the Drag and Drop operation, and may be used in a number of scenarios: 1 default instance per JVM for the lifetime of that JVM.DragSourceAdapter An abstract adapter class for receiving drag source events.DragSourceContext TheDragSourceContext
class is responsible for managing the initiator side of the Drag and Drop protocol.DragSourceDragEvent TheDragSourceDragEvent
is delivered from theDragSourceContextPeer
, via theDragSourceContext
, to theDragSourceListener
registered with thatDragSourceContext
and with its associatedDragSource
.DragSourceDropEvent TheDragSourceDropEvent
is delivered from theDragSourceContextPeer
, via theDragSourceContext
, to thedragDropEnd
method ofDragSourceListener
s registered with thatDragSourceContext
and with its associatedDragSource
.DragSourceEvent This class is the base class forDragSourceDragEvent
andDragSourceDropEvent
.DropTarget TheDropTarget
is associated with aComponent
when thatComponent
wishes to accept drops during Drag and Drop operations.DropTarget.DropTargetAutoScroller this protected nested class implements autoscrollingDropTargetAdapter An abstract adapter class for receiving drop target events.DropTargetContext ADropTargetContext
is created whenever the logical cursor associated with a Drag and Drop operation coincides with the visible geometry of aComponent
associated with aDropTarget
.DropTargetDragEvent TheDropTargetDragEvent
is delivered to aDropTargetListener
via its dragEnter() and dragOver() methods.DropTargetDropEvent TheDropTargetDropEvent
is delivered via theDropTargetListener
drop() method.DropTargetEvent TheDropTargetEvent
is the base class for both theDropTargetDragEvent
and theDropTargetDropEvent
.MouseDragGestureRecognizer This abstract subclass ofDragGestureRecognizer
defines aDragGestureRecognizer
for mouse-based gestures. -
Exception Summary Exception Description InvalidDnDOperationException This exception is thrown by various methods in the java.awt.dnd package.
Package java.awt.dnd Description
This package defines the classes and interfaces necessary to perform Drag and Drop operations in Java. It defines classes for the drag-source and the drop-target, as well as events for transferring the data being dragged. This package also provides a means for giving visual feedback to the user throughout the duration of the Drag and Drop operation.
A typical Drag and Drop operation can be decomposed into the following states (not entirely sequentially):
- A
DragSource
comes into existence, associated with some presentation element (Component
) in the GUI, to initiate a Drag and Drop of some potentiallyTransferable
data. - 1 or more
DropTarget
(s) come into/go out of existence, associated with presentation elements in the GUI (Components), potentially capable of consumingTransferable
data types. - A
DragGestureRecognizer
is obtained from theDragSource
and is associated with aComponent
in order to track and identify any Drag initiating gesture by the user over theComponent
. - A user makes a Drag gesture over the
Component
, which the registeredDragGestureRecognizer
detects, and notifies itsDragGestureListener
of.Note: Although this API consistently refers to the stimulus for a drag and drop operation being a physical gesture by a human user, this does not preclude a programmatically driven DnD operation given the appropriate implementation of a
DragSource
. This package contains the abstract classMouseDragGestureRecognizer
for recognizing mouse device gestures. Other abstract subclasses may be provided by the platform to support other input devices or particularComponent
class semantics. - The
DragGestureListener
causes theDragSource
to initiate the Drag and Drop operation on behalf of the user, perhaps animating the GUI Cursor and/or rendering anImage
of the item(s) that are the subject of the operation. - As the user gestures navigate over
Component
(s) in the GUI with associatedDropTarget
(s), theDragSource
receives notifications in order to provide "Drag Over" feedback effects, and theDropTarget
(s) receive notifications in order to provide "Drag Under" feedback effects based upon the operation(s) supported and the data type(s) involved.
The gesture itself moves a logical cursor across the GUI hierarchy,
intersecting the geometry of GUI Component(s), possibly resulting in
the logical "Drag" cursor entering, crossing, and subsequently
leaving Component
(s) and associated DropTarget
(s).
The DragSource
object manifests "Drag Over" feedback to the user, in the typical case by animating the GUI Cursor
associated with the
logical cursor.
DropTarget
objects manifest "Drag Under" feedback to the user, in
the typical case, by rendering animations into their associated GUI
Component
(s) under the GUI Cursor.
The determination of the feedback effects, and the ultimate success or failure of the data transfer, should one occur, is parameterized as follows:
- By the transfer "operation" selected by the user, and supported by
both the
DragSource
andDropTarget
: Copy, Move or Reference(link). - By the intersection of the set of data types provided by the
DragSource
and the set of data types comprehensible by theDropTarget
. - When the user terminates the drag operation, normally resulting in a
successful Drop, both the
DragSource
andDropTarget
receive notifications that include, and result in the type negotiation and transfer of, the information associated with theDragSource
via aTransferable
object.
- Since:
- 1.2
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/awt/dnd/package-summary.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.