com.alee.examples.groups.complex
Class ComplexExample.ShadeBackgroundPainter

java.lang.Object
  extended by com.alee.extended.painter.AbstractPainter<javax.swing.JComponent>
      extended by com.alee.examples.groups.complex.ComplexExample.ShadeBackgroundPainter
All Implemented Interfaces:
Painter<javax.swing.JComponent>
Enclosing class:
ComplexExample

public class ComplexExample.ShadeBackgroundPainter
extends AbstractPainter<javax.swing.JComponent>

Custom shade background painter.


Field Summary
protected  java.awt.image.BufferedImage bg
          Background image.
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Constructor Summary
ComplexExample.ShadeBackgroundPainter(java.awt.image.BufferedImage bg)
          Constructs new shade background painter.
 
Method Summary
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          Returns preferred size required for proper painting of visual data provided by this painter.
protected  NinePatchIcon getShadeIcon()
          Returns shade icon.
 void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, javax.swing.JComponent c)
          Paints visual data onto the component graphics.
 
Methods inherited from class com.alee.extended.painter.AbstractPainter
addPainterListener, getMargin, 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

bg

protected java.awt.image.BufferedImage bg
Background image.

Constructor Detail

ComplexExample.ShadeBackgroundPainter

public ComplexExample.ShadeBackgroundPainter(java.awt.image.BufferedImage bg)
Constructs new shade background painter.

Parameters:
bg - background image
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Returns preferred size required for proper painting of visual data provided by this painter. This should not take into account any sizes not related to this painter settings (for example text size on button).

Specified by:
getPreferredSize in interface Painter<javax.swing.JComponent>
Overrides:
getPreferredSize in class AbstractPainter<javax.swing.JComponent>
Parameters:
c - component to process
Returns:
preferred size required for proper painting of visual data provided by this painter

paint

public void paint(java.awt.Graphics2D g2d,
                  java.awt.Rectangle bounds,
                  javax.swing.JComponent 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

getShadeIcon

protected NinePatchIcon getShadeIcon()
Returns shade icon.

Returns:
shade icon