Interface DragHandler<T>

  • All Known Implementing Classes:
    AbstractDragAndDropHandler

    public interface DragHandler<T>
    A drag handler is responsible for creating drag tokens from a drag source. It acts as the bridge between a UI component that can act as a drag source and the drag token framework.
    Since:
    3.0
    Author:
    Chris Jennings
    See Also:
    DropHandler, DragManager
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      DragToken<T> createDragToken​(DragManager<T> manager, javax.swing.JComponent dragSource, java.awt.Point dragPoint)
      Creates a drag token for a drag that was initiated in the specified drag source at the specified point.
      void dragFinished​(DragManager<T> manager, javax.swing.JComponent dragSource, DragToken<T> token, javax.swing.JComponent dropTarget)
      Called when a drag gesture finishes, whether the drag token was successfully dropped or not.
    • Method Detail

      • createDragToken

        DragToken<T> createDragToken​(DragManager<T> manager,
                                     javax.swing.JComponent dragSource,
                                     java.awt.Point dragPoint)
        Creates a drag token for a drag that was initiated in the specified drag source at the specified point. Returns null if the specified point is not draggable.
        Parameters:
        manager - the manager that is managing the drag
        dragSource - the component being dragged from
        dragPoint - the point at which the drag began
        Returns:
        a drag token for the draggable object at the specified point
      • dragFinished

        void dragFinished​(DragManager<T> manager,
                          javax.swing.JComponent dragSource,
                          DragToken<T> token,
                          javax.swing.JComponent dropTarget)
        Called when a drag gesture finishes, whether the drag token was successfully dropped or not. This method is called after
        Parameters:
        manager - the manager that is managing the drag
        dragSource - the component being dragged from
        token - the token that was dragged
        dropTarget - the target that the token was dropped on, or null if the drag was cancelled