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

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

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

Texure painter. This painter fills component background with a texture based on the specified image.

Author:
Mikle Garin
See Also:
TextureType, AbstractPainter, Painter

Field Summary
protected  java.awt.TexturePaint paint
          Cached texture paint.
protected  TextureType textureType
          Texture type.
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Constructor Summary
TexturePainter(java.awt.image.BufferedImage image)
          Constructs texture paint with the specified image as a texture.
TexturePainter(java.awt.Image image)
          Constructs texture paint with the specified image as a texture.
TexturePainter(javax.swing.ImageIcon icon)
          Constructs texture paint with the specified icon as a texture.
TexturePainter(TextureType textureType)
          Constructs texture paint with the specified texture type.
 
Method Summary
 java.awt.image.BufferedImage getImage()
          Returns texture image.
 TextureType getTextureType()
          Returns texture type.
 void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, E c)
          Paints visual data onto the component graphics.
 void setImage(java.awt.image.BufferedImage image)
          Sets texture image.
 void setTextureType(TextureType textureType)
          Sets texture type.
protected  void updatePainter(java.awt.image.BufferedImage image)
          Updates cached texture paint.
 
Methods inherited from class com.alee.extended.painter.AbstractPainter
addPainterListener, getMargin, getPreferredSize, install, isOpaque, 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

paint

protected java.awt.TexturePaint paint
Cached texture paint.


textureType

protected TextureType textureType
Texture type.

Constructor Detail

TexturePainter

public TexturePainter(javax.swing.ImageIcon icon)
Constructs texture paint with the specified icon as a texture.

Parameters:
icon - texture icon

TexturePainter

public TexturePainter(java.awt.Image image)
Constructs texture paint with the specified image as a texture.

Parameters:
image - texture image

TexturePainter

public TexturePainter(java.awt.image.BufferedImage image)
Constructs texture paint with the specified image as a texture.

Parameters:
image - texture image

TexturePainter

public TexturePainter(TextureType textureType)
Constructs texture paint with the specified texture type.

Parameters:
textureType - predefined texture type
Method Detail

getTextureType

public TextureType getTextureType()
Returns texture type.

Returns:
texture type
See Also:
TextureType

setTextureType

public void setTextureType(TextureType textureType)
Sets texture type.

Parameters:
textureType - new texture type
See Also:
TextureType

getImage

public java.awt.image.BufferedImage getImage()
Returns texture image.

Returns:
texture image

setImage

public void setImage(java.awt.image.BufferedImage image)
Sets texture image.

Parameters:
image - new texture image

updatePainter

protected void updatePainter(java.awt.image.BufferedImage image)
Updates cached texture paint.

Parameters:
image - texture image

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