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

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

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

Alpha layer painter. This painter fills component background with an alpha-like texture.

Author:
Mikle Garin
See Also:
AbstractPainter, Painter

Field Summary
protected  java.awt.Color darkSquareColor
          Dark square color.
protected  java.awt.Color lightSquareColor
          Light square color.
protected  int squareSize
          Square size.
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Constructor Summary
AlphaLayerPainter()
          Constructs default alpha layer painter.
AlphaLayerPainter(java.awt.Color lightSquareColor, java.awt.Color darkSquareColor)
          Constructs alpha layer painter with a specified square colors.
AlphaLayerPainter(int squareSize)
          Constructs alpha layer painter with a specified square size.
AlphaLayerPainter(int squareSize, java.awt.Color lightSquareColor, java.awt.Color darkSquareColor)
          Constructs alpha layer painter with a specified square size and colors.
 
Method Summary
 java.awt.Color getDarkSquareColor()
          Returns dark square color.
 java.awt.Color getLightSquareColor()
          Returns light square color.
 int getSquareSize()
          Returns square size.
 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 setDarkSquareColor(java.awt.Color darkSquareColor)
          Sets dark square color.
 void setLightSquareColor(java.awt.Color lightSquareColor)
          Sets light square color.
 void setSquareSize(int squareSize)
          Sets square size.
 
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

squareSize

protected int squareSize
Square size.


lightSquareColor

protected java.awt.Color lightSquareColor
Light square color.


darkSquareColor

protected java.awt.Color darkSquareColor
Dark square color.

Constructor Detail

AlphaLayerPainter

public AlphaLayerPainter()
Constructs default alpha layer painter.


AlphaLayerPainter

public AlphaLayerPainter(int squareSize)
Constructs alpha layer painter with a specified square size.


AlphaLayerPainter

public AlphaLayerPainter(java.awt.Color lightSquareColor,
                         java.awt.Color darkSquareColor)
Constructs alpha layer painter with a specified square colors.


AlphaLayerPainter

public AlphaLayerPainter(int squareSize,
                         java.awt.Color lightSquareColor,
                         java.awt.Color darkSquareColor)
Constructs alpha layer painter with a specified square size and colors.

Method Detail

getSquareSize

public int getSquareSize()
Returns square size.

Returns:
square size

setSquareSize

public void setSquareSize(int squareSize)
Sets square size.

Parameters:
squareSize - new square size

getLightSquareColor

public java.awt.Color getLightSquareColor()
Returns light square color.

Returns:
light square color

setLightSquareColor

public void setLightSquareColor(java.awt.Color lightSquareColor)
Sets light square color.

Parameters:
lightSquareColor - new light square color

getDarkSquareColor

public java.awt.Color getDarkSquareColor()
Returns dark square color.

Returns:
dark square color

setDarkSquareColor

public void setDarkSquareColor(java.awt.Color darkSquareColor)
Sets dark square color.

Parameters:
darkSquareColor - new dark square color

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.

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