Class RubberXOnly

All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener

public class RubberXOnly extends ADragRubberband
Rubberband "XONLY" policy: a vertical band spanning the full component height, with x determined by the drag.
  • Constructor Details

  • Method Details

    • startRubberbanding

      protected void startRubberbanding(Point anchorPt)
      Description copied from class: ARubberband
      Initialize rubberbanding state and capture the component image for drawing. Called at the start of the gesture, either from mousePressed() for drag-based policies or from begin() for toolbar-initiated gestures.
      Overrides:
      startRubberbanding in class ARubberband
      Parameters:
      anchorPt - the initial point of the gesture; must not be null
    • modifyCurrentPoint

      protected void modifyCurrentPoint(Point cp)
      Description copied from class: ARubberband
      Hook to modify the current point before using it. Default: clamp to component bounds (old Rubberband behavior).
      Overrides:
      modifyCurrentPoint in class ARubberband
    • draw

      protected void draw(Graphics2D g)
      Description copied from class: ARubberband
      Draw the rubberband shape based on the current state. Called during dragging or when the toolbar requests a preview update. Subclasses must implement this to define the visual appearance of the rubberband.
      Specified by:
      draw in class ARubberband
      Parameters:
      g -
    • getRubberbandBounds

      public Rectangle getRubberbandBounds()
      Description copied from class: ARubberband
      Get the bounding rectangle of the rubberband shape based on the current state. Used for area-based validity checks and as a default for vertex calculations. Subclasses should override this if their shape is not well-represented by a bounding rectangle (e.g. lines, polygons).
      Specified by:
      getRubberbandBounds in class ARubberband
      Returns:
      the bounding rectangle of the rubberband shape, or null if not applicable.