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 booleananchor(Point p)Set the anchor point.voiddone()Last point, done with drawing.abstract voiddrawLast(Graphics2D g)abstract voiddrawNext(Graphics2D g)voidend(Point p)Last point, done with drawing.PointgetAnchor()RectanglegetBounds()Get current BoundsPointgetEnd()PointgetLast()PointgetStretched()booleanisActive()RectanglelastBounds()Get previous BoundsvoidsetActive(boolean b)Set whether its in active mode.voidstretch(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
-
-