org.tbee.swing
Class ShadowBorder

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

public class ShadowBorder
extends Object
implements 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 String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
ShadowBorder()
          standaard 5 pixel gray shadow
ShadowBorder(int size, Color color)
          custom shadow
 
Method Summary
static ShadowBorder createBorder()
          FlyWeight pattern implementation standaard border
static ShadowBorder createBorder(int size, Color c)
          FlyWeight pattern implementation Custom border
static JPanel createJPanelWithShadow(Component component)
          Wrap a component in a JPanel with standard shadow
static JPanel createJPanelWithShadow(Component component, ShadowBorder shadowBorder)
          Wrap a component in a JPanel with shadow
 Insets getBorderInsets(Component c)
           
 boolean getUseNoise()
           
 boolean isBorderOpaque()
           
 void paintBorder(Component c, 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 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,
                    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 Insets getBorderInsets(Component c)
Specified by:
getBorderInsets in interface Border

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface Border

paintBorder

public void paintBorder(Component c,
                        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 Border

createBorder

public static ShadowBorder createBorder()
FlyWeight pattern implementation standaard border

Returns:

createBorder

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

Parameters:
c -
Returns:

createJPanelWithShadow

public static JPanel createJPanelWithShadow(Component component)
Wrap a component in a JPanel with standard shadow


createJPanelWithShadow

public static JPanel createJPanelWithShadow(Component component,
                                            ShadowBorder shadowBorder)
Wrap a component in a JPanel with shadow



Copyright © 2012 KnowledgePlaza. All Rights Reserved.