Class DragHandle


  • public abstract class DragHandle
    extends java.lang.Object
    A handle that can be attached to a component and that the user can drag to modify the item in some way.
    Author:
    Chris Jennings
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double dx  
      protected double dy  
      protected java.awt.geom.Point2D last  
      protected java.awt.geom.Point2D start  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void beginDrag​(java.awt.geom.Point2D startPoint, java.awt.event.MouseEvent e)  
      void cancelDrag()  
      void drag​(java.awt.geom.Point2D point, java.awt.event.MouseEvent e)  
      void endDrag()  
      java.awt.Cursor getCursor()
      Returns the cursor to use when the pointer is over this handle.
      PageItem getOwner()  
      boolean handleMovedDuringDrag()  
      abstract boolean hitTest​(java.awt.geom.Point2D p)
      Returns true if a point is over this handle.
      boolean isDragging()  
      abstract void paintDragState​(java.awt.Graphics2D g)  
      abstract void paintHandle​(java.awt.Graphics2D g)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • start

        protected java.awt.geom.Point2D start
      • last

        protected java.awt.geom.Point2D last
      • dx

        protected double dx
      • dy

        protected double dy
    • Constructor Detail

      • DragHandle

        public DragHandle​(PageItem owner)
    • Method Detail

      • paintHandle

        public abstract void paintHandle​(java.awt.Graphics2D g)
      • paintDragState

        public abstract void paintDragState​(java.awt.Graphics2D g)
      • hitTest

        public abstract boolean hitTest​(java.awt.geom.Point2D p)
        Returns true if a point is over this handle. When this method returns true, dragging the mouse would begin a drag operation.
        Parameters:
        p - the point to test
        Returns:
        true if the point falls within the handle
      • getCursor

        public java.awt.Cursor getCursor()
        Returns the cursor to use when the pointer is over this handle.

        DragHandle returns the default cursor.

        Returns:
        the cursor to use for this handle
      • beginDrag

        public void beginDrag​(java.awt.geom.Point2D startPoint,
                              java.awt.event.MouseEvent e)
      • drag

        public void drag​(java.awt.geom.Point2D point,
                         java.awt.event.MouseEvent e)
      • handleMovedDuringDrag

        public boolean handleMovedDuringDrag()
      • endDrag

        public void endDrag()
      • cancelDrag

        public void cancelDrag()
      • isDragging

        public boolean isDragging()