Package edu.cnu.mdi.graphics.rubberband
Class RubberYOnly
java.lang.Object
edu.cnu.mdi.graphics.rubberband.ARubberband
edu.cnu.mdi.graphics.rubberband.ADragRubberband
edu.cnu.mdi.graphics.rubberband.RubberYOnly
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener
Rubberband "YONLY" policy: a horizontal band spanning the full component width,
with y determined by the drag.
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
ARubberband.Policy -
Field Summary
Fields inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
active, backgroundImage, component, currentPt, fillColor, highlightColor1, highlightColor2, image, policy, poly, rubberbanded, started, startPt, tempPoly -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddraw(Graphics2D g) Draw the rubberband shape based on the current state.Get the bounding rectangle of the rubberband shape based on the current state.protected voidHook to modify the current point before using it.protected voidstartRubberbanding(Point anchorPt) Initialize rubberbanding state and capture the component image for drawing.Methods inherited from class edu.cnu.mdi.graphics.rubberband.ADragRubberband
mouseDragged, mousePressed, mouseReleasedMethods inherited from class edu.cnu.mdi.graphics.rubberband.ARubberband
addPoint, begin, cancel, computeVertices, endRubberbanding, getCurrent, getRubberbandVertices, getStart, isActive, isClickBased, isGestureValid, mouseClicked, mouseEntered, mouseExited, mouseMoved, setActive, setCurrent, setFillColor, setHighlightColor1, setHighlightColor2
-
Constructor Details
-
RubberYOnly
-
-
Method Details
-
startRubberbanding
Description copied from class:ARubberbandInitialize 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:
startRubberbandingin classARubberband- Parameters:
anchorPt- the initial point of the gesture; must not benull
-
modifyCurrentPoint
Description copied from class:ARubberbandHook to modify the current point before using it. Default: clamp to component bounds (old Rubberband behavior).- Overrides:
modifyCurrentPointin classARubberband
-
draw
Description copied from class:ARubberbandDraw 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:
drawin classARubberband- Parameters:
g-
-
getRubberbandBounds
Description copied from class:ARubberbandGet 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:
getRubberbandBoundsin classARubberband- Returns:
- the bounding rectangle of the rubberband shape, or null if not applicable.
-