java.lang.Object | |
↳ | sun.swing.CachedPainter |
![]() |
A base class used for icons or images that are expensive to paint. A subclass will do the following:
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
.
paint
to draw the cached reprensentation at
the specified location.
getImage
to get the cached reprensentation and
draw the image yourself. This is primarly useful when you are not
using VolatileImage
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an instance of
CachedPainter that will cache up
to cacheCount images of this class. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Renders the cached image to the the passed in
Graphic . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates the image to cache.
| |||||||||||
Clear the image cache
| |||||||||||
Paints the image to the specified location.
| |||||||||||
Paints the representation to cache to the supplied Graphics.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates an instance of CachedPainter
that will cache up
to cacheCount
images of this class.
cacheCount | Max number of images to cache |
---|
Renders the cached image to the the passed in Graphic
.
If there is no cached image paintToImage
will be invoked.
paintImage
is invoked to paint the cached image.
c | Component rendering to, this may be null. |
---|---|
g | Graphics to paint to |
x | X-coordinate to render to |
y | Y-coordinate to render to |
w | Width to render in |
h | Height to render in |
Creates the image to cache. This returns an opaque image, subclasses that require translucency or transparency will need to override this method.
c | Component painting to |
---|---|
w | Width of image to create |
h | Height to image to create |
config | GraphicsConfiguration that will be rendered to, this may be null. |
args | Arguments passed to paint |
Clear the image cache
Paints the image to the specified location.
c | Component painting to |
---|---|
g | Graphics to paint to |
x | X coordinate to paint to |
y | Y coordinate to paint to |
w | Width to paint to |
h | Height to paint to |
image | Image to paint |
args | Arguments supplied to paint
|
Paints the representation to cache to the supplied Graphics.
c | Component painting to, may be null. |
---|---|
image | Image to paint to |
g | Graphics to paint to, obtained from the passed in Image. |
w | Width to paint to |
h | Height to paint to |
args | Arguments supplied to paint
|