Home » openjdk-7 » sun » swing » [javadoc | source]
sun.swing
abstract public class: CachedPainter [javadoc | source]
java.lang.Object
   sun.swing.CachedPainter

Direct Known Subclasses:
    Paint9Painter, SkinPainter

A base class used for icons or images that are expensive to paint. A subclass will do the following:
  1. Invoke 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.
  2. Override paintToImage to render the image. The code that lives here is equivalent to what previously would go in paintIcon, for an Icon.
The two ways to use this class are:
  1. Invoke paint to draw the cached reprensentation at the specified location.
  2. Invoke getImage to get the cached reprensentation and draw the image yourself. This is primarly useful when you are not using VolatileImage.
Constructor:
 public CachedPainter(int cacheCount) 
Method from sun.swing.CachedPainter Summary:
createImage,   flush,   paint,   paintImage,   paintToImage
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.swing.CachedPainter Detail:
 protected Image createImage(Component c,
    int w,
    int h,
    GraphicsConfiguration config,
    Object[] args) 
    Creates the image to cache. This returns an opaque image, subclasses that require translucency or transparency will need to override this method.
 protected  void flush() 
    Clear the image cache
 public  void paint(Component c,
    Graphics g,
    int x,
    int y,
    int w,
    int h,
    Object args) 
    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.
 protected  void paintImage(Component c,
    Graphics g,
    int x,
    int y,
    int w,
    int h,
    Image image,
    Object[] args) 
    Paints the image to the specified location.
 abstract protected  void paintToImage(Component c,
    Image image,
    Graphics g,
    int w,
    int h,
    Object[] args)
    Paints the representation to cache to the supplied Graphics.