org.formaria.swing.painter
Class GradientBackground

java.lang.Object
  extended by org.formaria.swing.painter.GradientBackground
All Implemented Interfaces:
TitlePainter
Direct Known Subclasses:
BandPainter, FlarePainter, LogoBackground

public class GradientBackground
extends java.lang.Object
implements TitlePainter

Paints a background with a linear gradient

Copyright (c) Formaria Ltd., 2008

License: see license.txt

$Revision: 1.3 $


Field Summary
protected  boolean blend
           
protected  Project currentProject
           
protected  java.lang.String title
           
protected  java.awt.Color titleColor
           
protected  java.awt.Font titleFont
           
protected  float titleHeight
           
protected  int titlePos
           
protected  java.awt.Color titleTextColor
           
 
Fields inherited from interface org.formaria.swing.painter.TitlePainter
BOTTOM, LEFT, RIGHT, TOP
 
Constructor Summary
GradientBackground()
           
 
Method Summary
protected  java.awt.Paint getBackgroundPaint(java.awt.Color start, float wScreen, float hScreen, java.awt.Color end)
          Get the paint operation for the background
 void paint(java.awt.Graphics2D g, javax.swing.JComponent obj, int w, int h)
          Paints a background with a watermark like logo.
 void paint(java.awt.Graphics2D g, java.lang.Object object, int width, int height)
           
protected  void paintBackground(java.awt.Graphics2D g2, float w, float h, float wScreen, float hScreen, java.awt.Color start, java.awt.Color end)
          Paint an area of the background
protected  void paintExtras(java.awt.Graphics2D g2d, java.lang.Object obj, int w, int h)
          Paint any extra elements using the current transormation
 void setBlend(boolean b)
          Set the blend flag.
 void setTitle(java.lang.String text)
          Set the title text
 void setTitleColor(java.awt.Color c)
          Set the title/underline color
 void setTitleFont(java.awt.Font f)
          Set the title font
 void setTitlePosition(int pos)
          Set the title position
 void setTitleTextColor(java.awt.Color c)
          Set the title/underline text color
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

titleColor

protected java.awt.Color titleColor

titleTextColor

protected java.awt.Color titleTextColor

titleFont

protected java.awt.Font titleFont

titleHeight

protected float titleHeight

blend

protected boolean blend

title

protected java.lang.String title

titlePos

protected int titlePos

currentProject

protected Project currentProject
Constructor Detail

GradientBackground

public GradientBackground()
Method Detail

paint

public void paint(java.awt.Graphics2D g,
                  java.lang.Object object,
                  int width,
                  int height)

paint

public void paint(java.awt.Graphics2D g,
                  javax.swing.JComponent obj,
                  int w,
                  int h)
Paints a background with a watermark like logo. The foreground and background colors are used.

Parameters:
g - the graphics context
obj - The object/component being painted
w - the width coordinate
h - the height coordinate

Copyright: Copyright (c) Formaria Ltd., 2008
License: see license.txt $Revision: 1.3 $


getBackgroundPaint

protected java.awt.Paint getBackgroundPaint(java.awt.Color start,
                                            float wScreen,
                                            float hScreen,
                                            java.awt.Color end)
Get the paint operation for the background

Parameters:
start - the starting color
wScreen - the width
hScreen - the height
end - the ending color
Returns:
the paint operation

paintBackground

protected void paintBackground(java.awt.Graphics2D g2,
                               float w,
                               float h,
                               float wScreen,
                               float hScreen,
                               java.awt.Color start,
                               java.awt.Color end)
Paint an area of the background

Parameters:
g2 - the graphics context
x - the left coordinate
y - the top coordinate
w - the width coordinate
h - the height coordinate
wScreen - the width of the gradient
h - the height of the gradient
start - the start color
end - the end color

paintExtras

protected void paintExtras(java.awt.Graphics2D g2d,
                           java.lang.Object obj,
                           int w,
                           int h)
Paint any extra elements using the current transormation

Parameters:
obj - The object/component being painted
g2d - the graphics context
w - the width coordinate
h - the height coordinate

setTitleColor

public void setTitleColor(java.awt.Color c)
Set the title/underline color

Specified by:
setTitleColor in interface TitlePainter
Parameters:
c - the color

setTitleTextColor

public void setTitleTextColor(java.awt.Color c)
Set the title/underline text color

Specified by:
setTitleTextColor in interface TitlePainter
Parameters:
c - the color

setTitleFont

public void setTitleFont(java.awt.Font f)
Set the title font

Specified by:
setTitleFont in interface TitlePainter
Parameters:
f - the font

setBlend

public void setBlend(boolean b)
Set the blend flag.

Specified by:
setBlend in interface TitlePainter
Parameters:
b - true to blend into the parent space so that siblings panels for a single painted area, false to paint just this area without regard to other areas

setTitle

public void setTitle(java.lang.String text)
Set the title text

Specified by:
setTitle in interface TitlePainter
Parameters:
text - the new title

setTitlePosition

public void setTitlePosition(int pos)
Set the title position

Specified by:
setTitlePosition in interface TitlePainter
Parameters:
pos - the title position