org.jvnet.substance
Class SubstanceFillBackgroundDelegate

java.lang.Object
  extended by org.jvnet.substance.SubstanceFillBackgroundDelegate

public class SubstanceFillBackgroundDelegate
extends java.lang.Object

Delegate for painting filled backgrounds.

Author:
Kirill Grouchnikov

Constructor Summary
SubstanceFillBackgroundDelegate()
          Creates a new opaque fill background delegate.
SubstanceFillBackgroundDelegate(float alphaComposite)
          Creates a new translucent fill background delegate.
 
Method Summary
 void fillAndWatermark(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Color fillColor, java.awt.Rectangle rect)
          Updates the background of the specified component on the specified graphic context in the specified rectangle.
 void setAlphaComposite(float alphaComposite)
          Sets the alpha (translucency) attribute for this delegate.
 void update(java.awt.Graphics g, java.awt.Component c)
          Updates the background of the specified component on the specified graphic context.
 void update(java.awt.Graphics g, java.awt.Component c, boolean useHeaderPainter)
          Updates the background of the specified component on the specified graphic context.
 void updateIfOpaque(java.awt.Graphics g, java.awt.Component c)
          Updates the background of the specified component on the specified graphic context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstanceFillBackgroundDelegate

public SubstanceFillBackgroundDelegate()
Creates a new opaque fill background delegate.


SubstanceFillBackgroundDelegate

public SubstanceFillBackgroundDelegate(float alphaComposite)
Creates a new translucent fill background delegate.

Parameters:
alphaComposite - Alpha composite of this delegate. The default value is 1.0 which results in completely opaque background. However, in some cases, we need to draw partially translucent background, as in menus.
Method Detail

update

public void update(java.awt.Graphics g,
                   java.awt.Component c)
Updates the background of the specified component on the specified graphic context.

Parameters:
g - Graphic context.
c - Component.

updateIfOpaque

public void updateIfOpaque(java.awt.Graphics g,
                           java.awt.Component c)
Updates the background of the specified component on the specified graphic context. The background is updated only if the component is opaque.

Parameters:
g - Graphic context.
c - Component.

update

public void update(java.awt.Graphics g,
                   java.awt.Component c,
                   boolean useHeaderPainter)
Updates the background of the specified component on the specified graphic context.

Parameters:
g - Graphic context.
c - Component.
useHeaderPainter - If true, the currently installed title painter will be used. The SubstanceHeaderPainter that has been added in version 3.3 handles background paintings on controls in menu bars and tool bars (the latter depends on the value of SubstanceHeaderPainter.isPaintingContainer(Container).

fillAndWatermark

public void fillAndWatermark(java.awt.Graphics g,
                             javax.swing.JComponent c,
                             java.awt.Color fillColor,
                             java.awt.Rectangle rect)
Updates the background of the specified component on the specified graphic context in the specified rectangle.

Parameters:
g - Graphic context.
c - Component.
fillColor - Fill color.
rect - The rectangle to fill.

setAlphaComposite

public void setAlphaComposite(float alphaComposite)
Sets the alpha (translucency) attribute for this delegate.

Parameters:
alphaComposite - Alpha (translucency) attribute for this delegate.