com.dlsc.flexgantt.swing.util
Class GradientBorder

java.lang.Object
  extended by com.dlsc.flexgantt.swing.util.GradientBorder
All Implemented Interfaces:
javax.swing.border.Border

public class GradientBorder
extends java.lang.Object
implements javax.swing.border.Border

A border implementation that draws a gradient in the background. The gradient is based on two background colors. Additionally a line will be drawn as a border. The gradient background will only be visible if the component that uses it is not opaque.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
JComponent.setOpaque(boolean), JComponent.setBorder(Border)

Constructor Summary
GradientBorder()
           
 
Method Summary
 java.awt.Color getBackgroundColor1()
          Returns the background color with which the gradient starts painting itself.
 java.awt.Color getBackgroundColor2()
          Returns the background color with which the gradient stops painting itself.
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
 java.awt.Color getLineColor()
          Returns the color used for drawing the border line.
 boolean isBorderOpaque()
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
           
 void setBackgroundColor1(java.awt.Color color)
          Sets the background color with which the gradient starts painting itself.
 void setBackgroundColor2(java.awt.Color color)
          Returns the background color with which the gradient stops painting itself.
 void setLineColor(java.awt.Color color)
          Sets the color used for drawing the border line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GradientBorder

public GradientBorder()
Method Detail

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface javax.swing.border.Border

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Specified by:
paintBorder in interface javax.swing.border.Border

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Specified by:
getBorderInsets in interface javax.swing.border.Border

getBackgroundColor1

public java.awt.Color getBackgroundColor1()
Returns the background color with which the gradient starts painting itself.

Returns:
the background color with which the gradient starts painting itself
Since:
1.0

setBackgroundColor1

public void setBackgroundColor1(java.awt.Color color)
Sets the background color with which the gradient starts painting itself.

Parameters:
color - the background color with which the gradient starts painting itself
Since:
1.0

getBackgroundColor2

public java.awt.Color getBackgroundColor2()
Returns the background color with which the gradient stops painting itself.

Returns:
the background color with which the gradient stops painting itself
Since:
1.0

setBackgroundColor2

public void setBackgroundColor2(java.awt.Color color)
Returns the background color with which the gradient stops painting itself.

Parameters:
color - the background color with which the gradient stops painting itself
Since:
1.0

getLineColor

public java.awt.Color getLineColor()
Returns the color used for drawing the border line.

Returns:
the color used for drawing the border line
Since:
1.0

setLineColor

public void setLineColor(java.awt.Color color)
Sets the color used for drawing the border line.

Parameters:
color - the color used for drawing the border line
Since:
1.0