Interface DragSource


  • public interface DragSource
    Interface representing a drag source.
    • Method Detail

      • beginDrag

        boolean beginDrag​(Component component,
                          int x,
                          int y)
        Called by the framework to initiate a drag operation.
        Parameters:
        component - The component to drag from.
        x - The X-position of the mouse at the beginning of the drag.
        y - The Y-position of the mouse.
        Returns:
        true to accept the drag; false to reject it.
      • endDrag

        void endDrag​(Component component,
                     DropAction dropAction)
        Called by the framework to terminate a drag operation.
        Parameters:
        component - The drag component.
        dropAction - Which operation to perform at the end of the drag.
      • isNative

        boolean isNative()
        Returns the drag source's native flag.
        Returns:
        If true, the drag will be executed via the native OS. Otherwise, it will be executed locally.
      • getContent

        LocalManifest getContent()
        Returns:
        The drag content.
      • getRepresentation

        Visual getRepresentation()
        Returns a visual representing the drag content.
        Returns:
        The drag visual, or null for no visual.
      • getOffset

        Point getOffset()
        Returns the offset of the mouse pointer within the drag visual. Not required unless a representation is specified.
        Returns:
        The mouse offset within the drag visual, or null if no visual is specified.
      • getSupportedDropActions

        int getSupportedDropActions()
        Returns the drop actions supported by this drag source.
        Returns:
        A bitfield of the supported drop actions.