com.croftsoft.core.animation.painter
Class ColorPainter

java.lang.Object
  extended by com.croftsoft.core.animation.painter.ColorPainter
All Implemented Interfaces:
ComponentPainter, Serializable

public final class ColorPainter
extends Object
implements ComponentPainter, Serializable

Fills an area of the JComponent with a Color.

Useful for setting the background Color of a Component. Note that if you are also using an opaque (non-transparent) background Image, using a background Color could be a waste of CPU cycles if it is completely covered by the background Image.

Semi-transparent Colors may be useful for darkening or color tinting a scene.

Since:
2002-02-18
Version:
2003-08-05
See Also:
Serialized Form
Author:
David Wallace Croft

Constructor Summary
ColorPainter()
           
ColorPainter(Color color)
           
ColorPainter(Color color, Shape shape)
          Main constructor.
 
Method Summary
 Color getColor()
           
 Shape getShape()
           
 void paint(JComponent component, Graphics2D graphics)
           
 void setColor(Color color)
           
 void setShape(Shape shape)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorPainter

public ColorPainter(Color color,
                    Shape shape)
Main constructor.

Parameters:
color - If null, the component background color will be used.
shape - If null, the entire component will be colored.

ColorPainter

public ColorPainter(Color color)

ColorPainter

public ColorPainter()
Method Detail

getColor

public Color getColor()

getShape

public Shape getShape()

setColor

public void setColor(Color color)

setShape

public void setShape(Shape shape)

paint

public void paint(JComponent component,
                  Graphics2D graphics)
Specified by:
paint in interface ComponentPainter

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)