All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.Effect3D

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----tea.set.Effect3D

public class Effect3D
extends Container
implements Decorator
Effect3D is a decorator used to add 3D effects to an AWT component. It can take any AWT component and attaches a 3D look to it. There are currently four styles of 3D effects supported:
RAISED
the component looks like raised from the surface
LOWERED
the component looks like lowered from the surface
RAISED_BORDER
add a raised 3D border
LOWERED_BORDER
add a lowered 3D border
An optional caption can be added to the 3D border. It will be displayed at the upper-left hand side of the 3D box. This is appropriate for the RAISED_BORDER and LOWERED_BORDER options, but won't look nice with RAISED and LOWERED options.
 Example:
 Panel p = new Panel();
 p.add(new Effect3D(new Calendar(), Effect3D.RAISED_BORDER));
 

Effect3D supports the following properties:
Property NameProperty TypeDescription
ComponentComponent Managed component of this Effect3D.
Styleint 3D border style.
Borderint Border width in pixels.
CaptionString Caption text.
CaptionPosint Caption text position flag, Effect3D.LEFT, Effect3D.CENTER, or Effect3D.RIGHT.


Variable Index

 o CENTER
Center the caption text.
 o LEFT
Left justify the caption text.
 o LOWERED
Lowered 3D effect.
 o LOWERED_BORDER
Lowered 3D border effect.
 o PLAIN
Plain lines.
 o RAISED
Raised 3D effect.
 o RAISED_BORDER
Raised 3D border effect.
 o RIGHT
Right justify the caption text.

Constructor Index

 o Effect3D()
Construct an empty Effect3D.
 o Effect3D(Component)
Construct a 3D look and feel for the component.
 o Effect3D(Component, int)
Construct a 3D look and feel for the component with specified style.
 o Effect3D(Component, int, int)
Construct a 3D look and feel for the component with specified style and border width.
 o Effect3D(Component, String)
Construct a 3D look and feel for the component.
 o Effect3D(Component, String, int)
Construct a 3D look and feel for the component with specified style.
 o Effect3D(Component, String, int, int)
Construct a 3D look and feel for the component with specified style and border width.

Method Index

 o doLayout()
Layout the component.
 o getBorder()
Get the border width.
 o getCaption()
Get the caption string of this 3D box.
 o getCaptionPos()
Get the caption position setting.
 o getChild()
Get the decorated component.
 o getComponent()
Get the managed component of this Effect3D.
 o getMinimumSize()
Minimum size is the minimum size of the component increased by the border width.
 o getPreferredSize()
Preferred size is the preferred size of the component increased by the border width.
 o getStyle()
Get the 3D effect style.
 o paint(Graphics)
Paint 3D border and component.
 o setBorder(int)
Set the border width.
 o setCaption(String)
Set the caption for this 3D box.
 o setCaptionPos(int)
Set the caption position, left, center, or right.
 o setComponent(Component)
Set the managed component of this Effect3D.
 o setStyle(int)
Set the style of the 3D effect.

Variables

 o RAISED
 public static final int RAISED
Raised 3D effect.

 o LOWERED
 public static final int LOWERED
Lowered 3D effect.

 o RAISED_BORDER
 public static final int RAISED_BORDER
Raised 3D border effect.

 o LOWERED_BORDER
 public static final int LOWERED_BORDER
Lowered 3D border effect.

 o PLAIN
 public static final int PLAIN
Plain lines.

 o LEFT
 public static final int LEFT
Left justify the caption text.

 o CENTER
 public static final int CENTER
Center the caption text.

 o RIGHT
 public static final int RIGHT
Right justify the caption text.

Constructors

 o Effect3D
 public Effect3D()
Construct an empty Effect3D. Effect3D.setComponent must be called to set the component of this Effect3D before use.

 o Effect3D
 public Effect3D(Component comp)
Construct a 3D look and feel for the component. Style defaults to RAISED.

Parameters:
comp - component to attach decorator to.
 o Effect3D
 public Effect3D(Component comp,
                 int style)
Construct a 3D look and feel for the component with specified style.

Parameters:
comp - component to attach decorator to.
style - 3D style.
 o Effect3D
 public Effect3D(Component comp,
                 int style,
                 int border)
Construct a 3D look and feel for the component with specified style and border width. Border width only affect RAISED and LOWERED styles.

Parameters:
comp - component to attach decorator to.
style - 3D style.
border - border width.
 o Effect3D
 public Effect3D(Component comp,
                 String caption)
Construct a 3D look and feel for the component. Style defaults to RAISED. Caption is displayed at upper-left cornor.

Parameters:
comp - component to attach decorator to.
caption - caption string.
 o Effect3D
 public Effect3D(Component comp,
                 String caption,
                 int style)
Construct a 3D look and feel for the component with specified style. Caption is displayed at upper-left cornor.

Parameters:
comp - component to attach decorator to.
caption - caption string.
style - 3D style.
 o Effect3D
 public Effect3D(Component comp,
                 String caption,
                 int style,
                 int border)
Construct a 3D look and feel for the component with specified style and border width. Border width only affect RAISED and LOWERED styles. Caption is displayed at upper-left cornor.

Parameters:
comp - component to attach decorator to.
caption - caption string.
style - 3D style.
border - border width.

Methods

 o setComponent
 public synchronized void setComponent(Component comp)
Set the managed component of this Effect3D.

Parameters:
comp - managed component.
 o getComponent
 public Component getComponent()
Get the managed component of this Effect3D.

Returns:
managed component.
 o setStyle
 public synchronized void setStyle(int style)
Set the style of the 3D effect. This method may cause a repaint.

Parameters:
style - 3D style.
 o getStyle
 public int getStyle()
Get the 3D effect style.

Returns:
the 3D effect style.
 o setBorder
 public synchronized void setBorder(int border)
Set the border width.

Parameters:
border - border width.
 o getBorder
 public int getBorder()
Get the border width.

Returns:
border width.
 o setCaption
 public void setCaption(String caption)
Set the caption for this 3D box. If caption is null, this method clears any existing caption if any.

Parameters:
caption - caption string.
 o getCaption
 public String getCaption()
Get the caption string of this 3D box.

Returns:
caption string.
 o setCaptionPos
 public synchronized void setCaptionPos(int pos)
Set the caption position, left, center, or right. The default is left.

Parameters:
pos - caption position flag.
 o getCaptionPos
 public int getCaptionPos()
Get the caption position setting.

Returns:
caption position flag.
 o getPreferredSize
 public Dimension getPreferredSize()
Preferred size is the preferred size of the component increased by the border width.

Returns:
preferred size of component plus decorator border.
Overrides:
getPreferredSize in class Container
 o getMinimumSize
 public Dimension getMinimumSize()
Minimum size is the minimum size of the component increased by the border width.

Returns:
minimum size of component plus decorator border.
Overrides:
getMinimumSize in class Container
 o paint
 public void paint(Graphics g)
Paint 3D border and component.

Parameters:
g - Graphics content of this component.
Overrides:
paint in class Container
 o doLayout
 public void doLayout()
Layout the component.

Overrides:
doLayout in class Container
 o getChild
 public Component getChild()
Get the decorated component.

Returns:
component.

All Packages  Class Hierarchy  This Package  Previous  Next  Index