public abstract class CanvasPane extends java.lang.Object implements EventAcceptor, CanvasComponent
Constructor and Description |
---|
CanvasPane() |
Modifier and Type | Method and Description |
---|---|
protected void |
_initNewLayer(CanvasLayer l)
Helper method to initialize a layer when it is added to this
pane.
|
protected void |
_nullifyLayer(CanvasLayer l)
Helper method to tell a layer when it is been removed from
this pane.
|
void |
dispatchEvent(java.awt.AWTEvent event)
Dispatch an AWT event on this pane.
|
JCanvas |
getCanvas()
Get the containing canvas, or null if there isn't one.
|
CanvasComponent |
getParent()
Get the parent component, or null if there isn't one.
|
java.awt.geom.Point2D |
getSize()
Get the size of this pane, in logical coordinates.
|
protected java.lang.String |
getToolTipText(LayerEvent event)
Get the toolTipText for the point in the given LayerEvent.
|
TransformContext |
getTransformContext()
Return the transform context of this pane.
|
boolean |
isAntialiasing()
Return whether or not this pane is antialiased.
|
boolean |
isEnabled()
Test the enabled flag of this pane.
|
java.util.Iterator |
layers()
Return an iteration of the layers, in undefined order.
|
abstract java.util.Iterator |
layersFromBack()
Return an iteration of the layers from back to front --
that is, in redraw order.
|
abstract java.util.Iterator |
layersFromFront()
Return an iteration of the layers from front to back --
that is, in event-processing order.
|
void |
paint(java.awt.Graphics2D g)
Paint this pane onto a 2D graphics context.
|
void |
paint(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D region)
Paint this pane onto a 2D graphics object, within the given
region.
|
protected void |
processLayerEvent(LayerEvent event)
Process a layer event that has occurred on this pane.
|
void |
repaint()
Schedule a repaint of this pane.
|
void |
repaint(DamageRegion d)
Accept notification that a repaint has occurred somewhere
in this pane.
|
void |
scale(double xcenter,
double ycenter,
double xscale,
double yscale)
Scale this pane the given amount.
|
void |
setAntialiasing(boolean val)
Set whether or not to use antialiasing
when drawing this pane.
|
void |
setCanvas(JCanvas canvas)
Set the containing canvas of this pane.
|
void |
setEnabled(boolean flag)
Set the enabled flag of this pane.
|
void |
setParent(CanvasComponent parent)
Set the parent component of this pane.
|
void |
setSize(double width,
double height)
Set the size of this pane, in logical coordinates.
|
void |
setSize(java.awt.geom.Point2D size)
Set the size of this pane, in logical coordinates.
|
void |
setTransform(java.awt.geom.AffineTransform at)
Set the transform that maps logical coordinates into the
parent's coordinates.
|
void |
translate(double x,
double y)
Translate this pane the given distance.
|
public void dispatchEvent(java.awt.AWTEvent event)
dispatchEvent
in interface EventAcceptor
event
- The eventpublic final CanvasComponent getParent()
getParent
in interface CanvasComponent
public final JCanvas getCanvas()
public final boolean isAntialiasing()
protected java.lang.String getToolTipText(LayerEvent event)
event
- The eventpublic final TransformContext getTransformContext()
getTransformContext
in interface CanvasComponent
public java.awt.geom.Point2D getSize()
public final boolean isEnabled()
isEnabled
in interface EventAcceptor
public java.util.Iterator layers()
public abstract java.util.Iterator layersFromBack()
public abstract java.util.Iterator layersFromFront()
public void paint(java.awt.Graphics2D g)
g
- The graphics context on which to paint.public void paint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D region)
g
- The graphics context on which to paint.region
- The object to be painted.protected void processLayerEvent(LayerEvent event)
event
- The layer eventpublic void repaint()
repaint
in interface CanvasComponent
public void repaint(DamageRegion d)
repaint
in interface CanvasComponent
d
- The damage region.public void setAntialiasing(boolean val)
val
- True if antialiasing is used when drawing.public final void setCanvas(JCanvas canvas)
canvas
- The containing canvas.public final void setEnabled(boolean flag)
setEnabled
in interface EventAcceptor
flag
- If false, then the pane will not respond to user
input events.public final void setParent(CanvasComponent parent)
parent
- The parent of the pane.public void setSize(double width, double height)
width
- The widthheight
- The heightpublic void setSize(java.awt.geom.Point2D size)
size
- The size of the pane.public final void setTransform(java.awt.geom.AffineTransform at)
at
- The transform.public void translate(double x, double y)
x
- The x amount by which to translate.y
- The y amount by which to translate.public void scale(double xcenter, double ycenter, double xscale, double yscale)
xcenter
- The x value of the point to scale about.ycenter
- The y value of the point to scale about.xscale
- The x amount of which to scale by.yscale
- The y amount of which to scale by.protected void _initNewLayer(CanvasLayer l)
l
- The canvas layerprotected void _nullifyLayer(CanvasLayer l)
l
- The canvas layer