org.tbee.swing
Class ShadowBorder

java.lang.Object
  extended by org.tbee.swing.ShadowBorder
All Implemented Interfaces:
javax.swing.border.Border

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

Create a shadowed (bottom right) border. Preferable use the static createBorder methods because of the FlyWeight pattern.

Version:
$Revision: 1.20 $

Field Summary
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
ShadowBorder()
          standaard 5 pixel gray shadow
ShadowBorder(int size, java.awt.Color color)
          custom shadow
 
Method Summary
static ShadowBorder createBorder()
          FlyWeight pattern implementation standaard border
static ShadowBorder createBorder(int size, java.awt.Color c)
          FlyWeight pattern implementation Custom border
static javax.swing.JPanel createJPanelWithShadow(java.awt.Component component)
          Wrap a component in a JPanel with standard shadow
static javax.swing.JPanel createJPanelWithShadow(java.awt.Component component, ShadowBorder shadowBorder)
          Wrap a component in a JPanel with shadow
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
 boolean getUseNoise()
           
 boolean isBorderOpaque()
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int w, int h)
          Even though this paint may take long to render the required shadow is noise is used.
 void setUseNoise(boolean noise)
          using noise make the shadow better but requires more time to renden
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

ShadowBorder

public ShadowBorder()
standaard 5 pixel gray shadow


ShadowBorder

public ShadowBorder(int size,
                    java.awt.Color color)
custom shadow

Method Detail

setUseNoise

public void setUseNoise(boolean noise)
using noise make the shadow better but requires more time to renden


getUseNoise

public boolean getUseNoise()

getBorderInsets

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

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 w,
                        int h)
Even though this paint may take long to render the required shadow is noise is used. Since swing runs only in one thread, there is no need to synchronize.

Specified by:
paintBorder in interface javax.swing.border.Border

createBorder

public static ShadowBorder createBorder()
FlyWeight pattern implementation standaard border

Returns:

createBorder

public static ShadowBorder createBorder(int size,
                                        java.awt.Color c)
FlyWeight pattern implementation Custom border

Parameters:
c -
Returns:

createJPanelWithShadow

public static javax.swing.JPanel createJPanelWithShadow(java.awt.Component component)
Wrap a component in a JPanel with standard shadow


createJPanelWithShadow

public static javax.swing.JPanel createJPanelWithShadow(java.awt.Component component,
                                                        ShadowBorder shadowBorder)
Wrap a component in a JPanel with shadow



Copyright © 2010. All Rights Reserved.