rubberband
Class Rubberband

java.lang.Object
  |
  +--rubberband.Rubberband
Direct Known Subclasses:
RubberbandRectangle, RubberbandRectangleX

public abstract class Rubberband
extends java.lang.Object

A abstract base class for rubberbands.

Rubberbands do their rubberbanding inside of a Component, which must be specified at construction time.

Subclasses are responsible for implementing void drawLast(Graphics g) and void drawNext(Graphics g). drawLast() draws the appropriate geometric shape at the last rubberband location, while drawNext() draws the appropriate geometric shape at the next rubberband location. All of the underlying support for rubberbanding is taken care of here, including handling XOR mode setting; extensions of Rubberband need not concern themselves with anything but drawing the last and next geometric shapes.

A note from Steve Verrill: This class was written by David Geary. See his book Graphic Java, Mastering the AWT.

See Also:
RubberbandLine, RubberbandRectangle, RubberbandEllipse, gjt.test.RubberbandTest

Field Summary
protected  java.awt.Point anchor
           
protected  java.awt.Point end
           
protected  java.awt.Point last
           
protected  java.awt.Point stretched
           
 
Constructor Summary
Rubberband(java.awt.Component component)
           
 
Method Summary
 void anchor(java.awt.Point p)
           
 java.awt.Rectangle bounds()
           
abstract  void drawLast(java.awt.Graphics g)
           
abstract  void drawNext(java.awt.Graphics g)
           
 void end(java.awt.Point p)
           
 java.awt.Point getAnchor()
           
 java.awt.Point getEnd()
           
 java.awt.Point getLast()
           
 java.awt.Point getStretched()
           
 java.awt.Rectangle lastBounds()
           
 void stretch(java.awt.Point p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

anchor

protected java.awt.Point anchor

stretched

protected java.awt.Point stretched

last

protected java.awt.Point last

end

protected java.awt.Point end
Constructor Detail

Rubberband

public Rubberband(java.awt.Component component)
Method Detail

drawLast

public abstract void drawLast(java.awt.Graphics g)

drawNext

public abstract void drawNext(java.awt.Graphics g)

getAnchor

public java.awt.Point getAnchor()

getStretched

public java.awt.Point getStretched()

getLast

public java.awt.Point getLast()

getEnd

public java.awt.Point getEnd()

anchor

public void anchor(java.awt.Point p)

stretch

public void stretch(java.awt.Point p)

end

public void end(java.awt.Point p)

bounds

public java.awt.Rectangle bounds()

lastBounds

public java.awt.Rectangle lastBounds()