Class Rubberband

    • Field Detail

      • anchorPt

        protected Point anchorPt
      • stretchedPt

        protected Point stretchedPt
      • lastPt

        protected Point lastPt
      • endPt

        protected Point endPt
      • firstStretch

        protected boolean firstStretch
    • Constructor Detail

      • Rubberband

        public Rubberband​(Component c,
                          boolean listen)
        Constructor. use if you want Rubberband to do the event listening.
        Parameters:
        c - draw on top of this Component.
    • Method Detail

      • drawLast

        public abstract void drawLast​(Graphics2D g)
      • drawNext

        public abstract void drawNext​(Graphics2D g)
      • setActive

        public void setActive​(boolean b)
        Set whether its in active mode. In active mode it listens for mouse drags and XOR draws.
        Parameters:
        b - true if in active mode.
      • isActive

        public boolean isActive()
      • getAnchor

        public Point getAnchor()
      • getStretched

        public Point getStretched()
      • getLast

        public Point getLast()
      • getEnd

        public Point getEnd()
      • anchor

        public boolean anchor​(Point p)
        Set the anchor point.
      • stretch

        public void stretch​(Point p)
        Erase the last rectangle and draw a new one from the anchor point to this point.
      • end

        public void end​(Point p)
        Last point, done with drawing.
      • done

        public void done()
        Last point, done with drawing.
      • getBounds

        public Rectangle getBounds()
        Get current Bounds
      • lastBounds

        public Rectangle lastBounds()
        Get previous Bounds