public abstract class CachedPainter
extends java.lang.Object
paint when you want to paint the image,
if you are implementing Icon you'll invoke this from
paintIcon.
The args argument is useful when additional state is needed.
paintToImage to render the image. The code that
lives here is equivalent to what previously would go in
paintIcon, for an Icon.
| Constructor and Description |
|---|
CachedPainter(int cacheCount)
Creates an instance of
CachedPainter that will cache up
to cacheCount images of this class. |
| Modifier and Type | Method and Description |
|---|---|
protected java.awt.Image |
createImage(java.awt.Component c,
int w,
int h,
java.awt.GraphicsConfiguration config)
Creates the image to cache.
|
protected void |
paint(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.lang.Object[] args)
Renders the cached image to the the passed in
Graphic. |
protected void |
paintImage(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.awt.Image image,
java.lang.Object[] args)
Paints the image to the specified location.
|
protected abstract void |
paintToImage(java.awt.Component c,
java.awt.Graphics g,
int w,
int h,
java.lang.Object[] args)
Paints the representation to cache to the supplied Graphics.
|
public CachedPainter(int cacheCount)
CachedPainter that will cache up
to cacheCount images of this class.cacheCount - Max number of images to cacheprotected void paint(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.lang.Object[] args)
Graphic.
If there is no cached image paintToImage will be invoked.
paintImage is invoked to paint the cached image.protected abstract void paintToImage(java.awt.Component c,
java.awt.Graphics g,
int w,
int h,
java.lang.Object[] args)
c - Component painting tog - Graphics to paint tow - Width to paint toh - Height to paint toargs - Arguments supplied to paintprotected void paintImage(java.awt.Component c,
java.awt.Graphics g,
int x,
int y,
int w,
int h,
java.awt.Image image,
java.lang.Object[] args)
c - Component painting tog - Graphics to paint tox - X coordinate to paint toy - Y coordinate to paint tow - Width to paint toh - Height to paint toimage - Image to paintargs - Arguments supplied to paintprotected java.awt.Image createImage(java.awt.Component c,
int w,
int h,
java.awt.GraphicsConfiguration config)
c - Component painting tow - Width of image to createh - Height to image to createconfig - GraphicsConfiguration that will be
rendered to, this may be null.