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));
-
LOWERED
- Lowered 3D effect.
-
LOWERED_BORDER
- Lowered 3D border effect.
-
RAISED
- Raised 3D effect.
-
RAISED_BORDER
- Raised 3D border effect.
-
Effect3D(Component)
- Construct a 3D look and feel for the component.
-
Effect3D(Component, int)
- Construct a 3D look and feel for the component with specified
style.
-
Effect3D(Component, int, int)
- Construct a 3D look and feel for the component with specified
style and border width.
-
Effect3D(Component, String)
- Construct a 3D look and feel for the component.
-
Effect3D(Component, String, int)
- Construct a 3D look and feel for the component with specified
style.
-
Effect3D(Component, String, int, int)
- Construct a 3D look and feel for the component with specified
style and border width.
-
layout()
- Layout the component.
-
minimumSize()
- Minimum size is the minimum size of the component increased
by the border width.
-
paint(Graphics)
- Paint 3D border and component.
-
preferredSize()
- Preferred size is the preferred size of the component increased
by the border width.
-
setBorder(int)
- Set the border width.
-
setCaption(String)
- Set the caption for this 3D box.
-
setStyle(int)
- Set the style of the 3D effect.
RAISED
public final static int RAISED
- Raised 3D effect.
LOWERED
public final static int LOWERED
- Lowered 3D effect.
RAISED_BORDER
public final static int RAISED_BORDER
- Raised 3D border effect.
LOWERED_BORDER
public final static int LOWERED_BORDER
- Lowered 3D border effect.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
paint
public void paint(Graphics g)
- Paint 3D border and component.
- Parameters:
- g - Graphics content of this component.
- Overrides:
- paint in class Component
layout
public void layout()
- Layout the component.
- Overrides:
- layout in class Container
All Packages Class Hierarchy This Package Previous Next Index