net.xoetrope.swing
Class XGradientBackground

java.lang.Object
  extended by net.xoetrope.swing.XGradientBackground
All Implemented Interfaces:
XTitlePainter, Painter
Direct Known Subclasses:
XLogoBackground

public class XGradientBackground
extends java.lang.Object
implements XTitlePainter

Paints a background with a linear gradient

Copyright (c) Xoetrope Ltd., 2002-2006

License: see license.txt

$Revision: 1.3 $


Field Summary
protected  boolean blend
           
protected  XProject 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 net.xoetrope.swing.painter.XTitlePainter
BOTTOM, LEFT, RIGHT, TOP
 
Constructor Summary
XGradientBackground()
           
 
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.
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 XProject currentProject
Constructor Detail

XGradientBackground

public XGradientBackground()
Method Detail

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.

Specified by:
paint in interface Painter
Parameters:
g - the graphics context
obj - The object/component being painted
w - the width coordinate
h - the height coordinate

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
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 XTitlePainter
Parameters:
c - the color

setTitleTextColor

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

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

setTitleFont

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

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

setBlend

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

Specified by:
setBlend in interface XTitlePainter
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 XTitlePainter
Parameters:
text - the new title

setTitlePosition

public void setTitlePosition(int pos)
Set the title position

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