Package ucar.nc2.ui.geoloc
Class Rubberband
- java.lang.Object
-
- ucar.nc2.ui.geoloc.Rubberband
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
RubberbandRectangle
,RubberbandRectangleHandles
public abstract class Rubberband extends Object implements Serializable
Implements XOR rubberbanding.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Rubberband(Component c, boolean listen)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
anchor(Point p)
Set the anchor point.void
done()
Last point, done with drawing.abstract void
drawLast(Graphics2D g)
abstract void
drawNext(Graphics2D g)
void
end(Point p)
Last point, done with drawing.Point
getAnchor()
Rectangle
getBounds()
Get current BoundsPoint
getEnd()
Point
getLast()
Point
getStretched()
boolean
isActive()
Rectangle
lastBounds()
Get previous Boundsvoid
setActive(boolean b)
Set whether its in active mode.void
stretch(Point p)
Erase the last rectangle and draw a new one from the anchor point to this point.
-
-
-
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
-
-