Package cnuphys.splot.rubberband
Class Rubberband
java.lang.Object
cnuphys.splot.rubberband.Rubberband
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum of possible rubber banding polices. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRubberband
(PlotCanvas canvas, IRubberbanded rubberbanded, Rubberband.Policy policy) Create a Rubberband -
Method Summary
Modifier and TypeMethodDescriptionvoid
Set the end point.Get the component being rubber banded.Get the current screen point.Return a rectangle that gives the final bounds of the rubber band.Point[]
Get the vertices of the rubber band.getStart()
Get the starting screen point.boolean
isActive()
Check whether this rubberband is active.void
setActive
(boolean b) This activates or deactivates the rubber banding.void
setFillColor
(Color color) Set the fill color for this rubber band.void
setHighlightColor1
(Color highlightColor1) Set one of the highlight colors used to stipple draw the boundary.void
setHighlightColor2
(Color highlightColor2) Set the other highlight color used to stipple draw the boundary.void
startRubberbanding
(Point anchorPt) Set the starting point to the given point.
-
Field Details
-
_highlightColor1
-
_highlightColor2
-
-
Constructor Details
-
Rubberband
Create a Rubberband- Parameters:
container
- the parent component being rubberbandedrubberbanded
- who gets notified when we are done.policy
- the stretching shape policy.
-
-
Method Details
-
setActive
public void setActive(boolean b) This activates or deactivates the rubber banding.- Parameters:
b
- the value of the active flag.
-
isActive
public boolean isActive()Check whether this rubberband is active.- Returns:
true
if active
-
getStart
Get the starting screen point.- Returns:
- the anchor (starting) screen point.
-
getCurrent
Get the current screen point.- Returns:
- The current screen point.
-
startRubberbanding
Set the starting point to the given point. Essentially reset the rubberbanding.- Parameters:
anchorPt
- the new starting screen point.
-
endRubberbanding
Set the end point.- Parameters:
p
- the end point.
-
getComponent
Get the component being rubber banded.- Returns:
- the component being rubber banded.
-
getRubberbandVertices
Get the vertices of the rubber band. For an oval, it the corners of the enclosing rectangle.- Returns:
- the rubber band vertices in a Point array.
-
getRubberbandBounds
Return a rectangle that gives the final bounds of the rubber band.- Returns:
- a bounding rectangle.
-
setFillColor
Set the fill color for this rubber band.- Parameters:
color
- the new fill color.
-
setHighlightColor1
Set one of the highlight colors used to stipple draw the boundary.- Parameters:
highlightColor1
- the value for the highlight color.
-
setHighlightColor2
Set the other highlight color used to stipple draw the boundary.- Parameters:
highlightColor2
- the value for the other highlight color.
-
getStartPt
- Returns:
- the _startPt
-
getCurrentPt
- Returns:
- the _currentPt
-