Class MouseDragBox

    • Constructor Detail

      • MouseDragBox

        public MouseDragBox​(JComponent component)
        Creates a new instance to work with the given component.
        component - the component on which the box will be drawn
    • Method Detail

      • setEnabled

        public void setEnabled​(boolean state)
        Enables or disables the drag box. When enabled, the box is drawn on mouse dragging.
        state - true to enable; false to disable
      • mousePressed

        public void mousePressed​(MouseEvent ev)
        If the box is enabled, records the start position for subsequent drawing as the mouse is dragged.
        Specified by:
        mousePressed in interface MouseListener
        mousePressed in class MouseAdapter
        ev - input mouse event