public class OverlayLayer extends CanvasLayer implements VisibleComponent
Although currently it does not do so, this class will become optimized so that repaints of this layer do not require a repaint of backing layers.
_containingPane
Constructor and Description |
---|
OverlayLayer()
Create a new OverlayLayer with a default one-pixel stroke
and a light grey stroke color.
|
OverlayLayer(java.awt.Stroke s,
java.awt.Paint p)
Create a new OverlayLayer with the given stroke and paint.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.awt.Shape s)
Add a new shape to the list of shapes in this layer.
|
void |
clear()
Clear the layer.
|
java.awt.Paint |
getPaint()
Get the current paint.
|
java.awt.Stroke |
getStroke()
Get the current paint stroke.
|
boolean |
isVisible()
Test the visibility flag of this layer.
|
void |
paint(java.awt.Graphics2D g)
Paint this layer onto a 2D graphics object.
|
void |
paint(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D region)
Paint this layer onto a 2D graphics object, within the given
region.
|
void |
remove(java.awt.Shape s)
Remove a shape from the list of shapes in this layer.
|
void |
repaint(java.awt.geom.Rectangle2D region)
Schedule a repaint of this layer over the given shape.
|
void |
repaint(java.awt.Shape shape)
Schedule a repaint of this layer over the given shape.
|
void |
setPaint(java.awt.Paint p)
Set the paint.
|
void |
setStroke(java.awt.Stroke s)
Set the stroke.
|
void |
setVisible(boolean flag)
Set the visibility flag of this layer.
|
java.util.Iterator |
shapes()
Return an iterator over the shapes currently in this layer.
|
getCanvasPane, getLayerBounds, getParent, getToolTipText, getTransformContext, repaint, repaint, setParent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParent, getTransformContext, repaint, repaint
public OverlayLayer()
public OverlayLayer(java.awt.Stroke s, java.awt.Paint p)
s
- The given strokep
- The given paintpublic void add(java.awt.Shape s)
s
- The shape to be addedpublic void clear()
public java.awt.Stroke getStroke()
setStroke(Stroke)
public java.awt.Paint getPaint()
setPaint(Paint)
public boolean isVisible()
isVisible
in interface VisibleComponent
setVisible(boolean)
public void paint(java.awt.Graphics2D g)
paint
in interface VisibleComponent
g
- The 2D graphics object that this object
it to be painted upon.public void paint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D region)
paint
in interface VisibleComponent
g
- The 2D graphics object that this object
it to be painted upon.region
- The region.public void remove(java.awt.Shape s)
s
- The Shape to be removedpublic void repaint(java.awt.geom.Rectangle2D region)
region
- The regionpublic void repaint(java.awt.Shape shape)
shape
- The given shapepublic java.util.Iterator shapes()
public void setStroke(java.awt.Stroke s)
s
- The strokegetStroke()
public void setPaint(java.awt.Paint p)
p
- The paintgetPaint()
public void setVisible(boolean flag)
setVisible
in interface VisibleComponent
flag
- the visibility flagisVisible()