Class tea.set.Effect3D
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.Effect3D

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

public class Effect3D
extends Panel
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));

Variable Index

 o LOWERED
Lowered 3D effect.
 o LOWERED_BORDER
Lowered 3D border effect.
 o RAISED
Raised 3D effect.
 o RAISED_BORDER
Raised 3D border effect.

Constructor Index

 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 layout()
Layout the component.
 o minimumSize()
Minimum size is the minimum size of the component increased by the border width.
 o paint(Graphics)
Paint 3D border and component.
 o preferredSize()
Preferred size is the preferred size of the component increased by the border width.
 o setBorder(int)
Set the border width.
 o setCaption(String)
Set the caption for this 3D box.
 o setStyle(int)
Set the style of the 3D effect.

Variables

 o RAISED
  public final static int RAISED
Raised 3D effect.
 o LOWERED
  public final static int LOWERED
Lowered 3D effect.
 o RAISED_BORDER
  public final static int RAISED_BORDER
Raised 3D border effect.
 o LOWERED_BORDER
  public final static int LOWERED_BORDER
Lowered 3D border effect.

Constructors

 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 setStyle
  public void setStyle(int style)
Set the style of the 3D effect. Reset border width to default. This method may cause a repaint.
Parameters:
style - 3D style.
 o setBorder
  public void setBorder(int border)
Set the border width. Only RAISED and LOWERED style are affected. RAISED_BORDER and LOWERED_BORDER always use 2 pixels as border width.
Parameters:
border - 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 preferredSize
  public Dimension preferredSize()
Preferred size is the preferred size of the component increased by the border width.
Returns:
preferred size of component plus decorator border.
Overrides:
preferredSize in class Container
 o minimumSize
  public Dimension minimumSize()
Minimum size is the minimum size of the component increased by the border width.
Returns:
minimum size of component plus decorator border.
Overrides:
minimumSize 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 Component
 o layout
  public void layout()
Layout the component.
Overrides:
layout in class Container

All Packages  Class Hierarchy  This Package  Previous  Next  Index