Class Rubberband

java.lang.Object
cnuphys.splot.rubberband.Rubberband

public final class Rubberband extends Object
  • Field Details

    • _highlightColor1

      public Color _highlightColor1
    • _highlightColor2

      public Color _highlightColor2
  • Constructor Details

    • Rubberband

      public Rubberband(PlotCanvas canvas, IRubberbanded rubberbanded, Rubberband.Policy policy)
      Create a Rubberband
      Parameters:
      container - the parent component being rubberbanded
      rubberbanded - 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

      public Point getStart()
      Get the starting screen point.
      Returns:
      the anchor (starting) screen point.
    • getCurrent

      public Point getCurrent()
      Get the current screen point.
      Returns:
      The current screen point.
    • startRubberbanding

      public void startRubberbanding(Point anchorPt)
      Set the starting point to the given point. Essentially reset the rubberbanding.
      Parameters:
      anchorPt - the new starting screen point.
    • endRubberbanding

      public void endRubberbanding(Point p)
      Set the end point.
      Parameters:
      p - the end point.
    • getComponent

      public Component getComponent()
      Get the component being rubber banded.
      Returns:
      the component being rubber banded.
    • getRubberbandVertices

      public Point[] 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

      public Rectangle getRubberbandBounds()
      Return a rectangle that gives the final bounds of the rubber band.
      Returns:
      a bounding rectangle.
    • setFillColor

      public void setFillColor(Color color)
      Set the fill color for this rubber band.
      Parameters:
      color - the new fill color.
    • setHighlightColor1

      public void setHighlightColor1(Color highlightColor1)
      Set one of the highlight colors used to stipple draw the boundary.
      Parameters:
      highlightColor1 - the value for the highlight color.
    • setHighlightColor2

      public void setHighlightColor2(Color highlightColor2)
      Set the other highlight color used to stipple draw the boundary.
      Parameters:
      highlightColor2 - the value for the other highlight color.
    • getStartPt

      public Point getStartPt()
      Returns:
      the _startPt
    • getCurrentPt

      public Point getCurrentPt()
      Returns:
      the _currentPt