| Package | Description | 
|---|---|
| java.awt.dnd | Drag and Drop is a direct manipulation gesture found in many Graphical
User Interface systems that provides a mechanism to transfer
information between two entities logically associated with presentation
elements in the GUI. | 
| Modifier and Type | Class and Description | 
|---|---|
| class  | DragSourceAdapterAn abstract adapter class for receiving drag source events. | 
| class  | DragSourceContextThe  DragSourceContextclass is responsible for managing the
 initiator side of the Drag and Drop protocol. | 
| Modifier and Type | Method and Description | 
|---|---|
| DragSourceListener[] | DragSource. getDragSourceListeners()Gets all the  DragSourceListeners
 registered with thisDragSource. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | DragSourceContext. addDragSourceListener(DragSourceListener dsl)Add a  DragSourceListenerto thisDragSourceContextif one has not already been added. | 
| void | DragSource. addDragSourceListener(DragSourceListener dsl)Adds the specified  DragSourceListenerto thisDragSourceto receive drag source events during drag
 operations intiated with thisDragSource. | 
| protected DragSourceContext | DragSource. createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp,
                       DragGestureEvent dgl,
                       Cursor dragCursor,
                       Image dragImage,
                       Point imageOffset,
                       Transferable t,
                       DragSourceListener dsl)Creates the  DragSourceContextto handle the current drag
 operation. | 
| void | DragSourceContext. removeDragSourceListener(DragSourceListener dsl)Removes the specified  DragSourceListenerfrom  thisDragSourceContext. | 
| void | DragSource. removeDragSourceListener(DragSourceListener dsl)Removes the specified  DragSourceListenerfrom thisDragSource. | 
| void | DragGestureEvent. startDrag(Cursor dragCursor,
         Image dragImage,
         Point imageOffset,
         Transferable transferable,
         DragSourceListener dsl)Start the drag given the initial  Cursorto display,
 a dragImage, the offset of
 theImage,
 theTransferableobject, and
 theDragSourceListenerto use. | 
| void | DragGestureEvent. startDrag(Cursor dragCursor,
         Transferable transferable,
         DragSourceListener dsl)Starts the drag given the initial  Cursorto display,
 theTransferableobject,
 and theDragSourceListenerto use. | 
| void | DragSource. startDrag(DragGestureEvent trigger,
         Cursor dragCursor,
         Image dragImage,
         Point dragOffset,
         Transferable transferable,
         DragSourceListener dsl)Start a drag, given the  DragGestureEventthat initiated the drag, the initialCursorto use,
 theImageto drag,
 the offset of theImageorigin
 from the hotspot of theCursorat the instant of the trigger,
 the subject data of the drag, and
 theDragSourceListener. | 
| void | DragSource. startDrag(DragGestureEvent trigger,
         Cursor dragCursor,
         Image dragImage,
         Point imageOffset,
         Transferable transferable,
         DragSourceListener dsl,
         FlavorMap flavorMap)Start a drag, given the  DragGestureEventthat initiated the drag, the initialCursorto use,
 theImageto drag,
 the offset of theImageorigin
 from the hotspot of theCursorat
 the instant of the trigger,
 theTransferablesubject data
 of the drag, theDragSourceListener,
 and theFlavorMap. | 
| void | DragSource. startDrag(DragGestureEvent trigger,
         Cursor dragCursor,
         Transferable transferable,
         DragSourceListener dsl)Start a drag, given the  DragGestureEventthat initiated the drag, the initialCursorto
 use,
 theTransferablesubject data
 of the drag, and theDragSourceListener. | 
| void | DragSource. startDrag(DragGestureEvent trigger,
         Cursor dragCursor,
         Transferable transferable,
         DragSourceListener dsl,
         FlavorMap flavorMap)Start a drag, given the  DragGestureEventthat initiated the drag, the initialCursorto use,
 theTransferablesubject data
 of the drag, theDragSourceListener,
 and theFlavorMap. | 
| Constructor and Description | 
|---|
| DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp,
                 DragGestureEvent trigger,
                 Cursor dragCursor,
                 Image dragImage,
                 Point offset,
                 Transferable t,
                 DragSourceListener dsl)Called from  DragSource, this constructor creates a newDragSourceContextgiven theDragSourceContextPeerfor this Drag, theDragGestureEventthat triggered the Drag, the initialCursorto use for the Drag, an (optional)Imageto display while the Drag is taking place, the offset
 of theImageorigin from the hotspot at the instant of the
 triggering event, theTransferablesubject data, and theDragSourceListenerto use during the Drag and Drop
 operation. | 
 Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.