com.alee.extended.painter
Class ColorPainter<E extends javax.swing.JComponent>

java.lang.Object
  extended by com.alee.extended.painter.AbstractPainter<E>
      extended by com.alee.extended.painter.ColorPainter<E>
Type Parameters:
E - component type
All Implemented Interfaces:
Painter<E>

public class ColorPainter<E extends javax.swing.JComponent>
extends AbstractPainter<E>

Simple color painter. This painter simply fills component background with a single color.

Author:
Mikle Garin
See Also:
AbstractPainter, Painter

Field Summary
protected  java.awt.Color color
          Color to fill component with.
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Constructor Summary
ColorPainter(java.awt.Color color)
          Constructs color painter with specified fill color.
 
Method Summary
 java.awt.Color getColor()
          Returns color to fill component with.
 java.lang.Boolean isOpaque(E c)
          Returns whether visual data provided by this painter is opaque or not.
 void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, E c)
          Paints visual data onto the component graphics.
 void setColor(java.awt.Color color)
          Sets color to fill component with.
 
Methods inherited from class com.alee.extended.painter.AbstractPainter
addPainterListener, getMargin, getPreferredSize, install, p, removePainterListener, repaint, repaint, repaint, revalidate, setMargin, setMargin, setMargin, setOpaque, setPreferredSize, uninstall, updateAll, updateOpacity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

protected java.awt.Color color
Color to fill component with.

Constructor Detail

ColorPainter

public ColorPainter(java.awt.Color color)
Constructs color painter with specified fill color.

Parameters:
color - color to fill component with
Method Detail

getColor

public java.awt.Color getColor()
Returns color to fill component with.

Returns:
color to fill component with

setColor

public void setColor(java.awt.Color color)
Sets color to fill component with.

Parameters:
color - new color to fill component with

isOpaque

public java.lang.Boolean isOpaque(E c)
Returns whether visual data provided by this painter is opaque or not. Returned value might affect component opacity depending on painter support inside that component UI. Simply return null if you don't want to change default component opacity.

Specified by:
isOpaque in interface Painter<E extends javax.swing.JComponent>
Overrides:
isOpaque in class AbstractPainter<E extends javax.swing.JComponent>
Parameters:
c - component to process
Returns:
true if visual data provided by this painter is opaque, false otherwise

paint

public void paint(java.awt.Graphics2D g2d,
                  java.awt.Rectangle bounds,
                  E c)
Paints visual data onto the component graphics. Provided graphics and component are taken directly from component UI paint method. Provided bounds are usually fake (zero location, component size) but in some cases it might be specified by componentUI.

Parameters:
g2d - component graphics
bounds - bounds for painter visual data
c - component to process