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 Name | Property Type | Description |
Component | Component |
Managed component of this Effect3D. |
Style | int |
3D border style. |
Border | int |
Border width in pixels. |
Caption | String |
Caption text. |
CaptionPos | int |
Caption text position flag, Effect3D.LEFT, Effect3D.CENTER,
or Effect3D.RIGHT. |
-
CENTER
- Center the caption text.
-
LEFT
- Left justify the caption text.
-
LOWERED
- Lowered 3D effect.
-
LOWERED_BORDER
- Lowered 3D border effect.
-
PLAIN
- Plain lines.
-
RAISED
- Raised 3D effect.
-
RAISED_BORDER
- Raised 3D border effect.
-
RIGHT
- Right justify the caption text.
-
Effect3D()
- Construct an empty Effect3D.
-
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.
-
doLayout()
- Layout the component.
-
getBorder()
- Get the border width.
-
getCaption()
- Get the caption string of this 3D box.
-
getCaptionPos()
- Get the caption position setting.
-
getChild()
- Get the decorated component.
-
getComponent()
- Get the managed component of this Effect3D.
-
getMinimumSize()
- Minimum size is the minimum size of the component increased
by the border width.
-
getPreferredSize()
- Preferred size is the preferred size of the component increased
by the border width.
-
getStyle()
- Get the 3D effect style.
-
paint(Graphics)
- Paint 3D border and component.
-
setBorder(int)
- Set the border width.
-
setCaption(String)
- Set the caption for this 3D box.
-
setCaptionPos(int)
- Set the caption position, left, center, or right.
-
setComponent(Component)
- Set the managed component of this Effect3D.
-
setStyle(int)
- Set the style of the 3D effect.
RAISED
public static final int RAISED
- Raised 3D effect.
LOWERED
public static final int LOWERED
- Lowered 3D effect.
RAISED_BORDER
public static final int RAISED_BORDER
- Raised 3D border effect.
LOWERED_BORDER
public static final int LOWERED_BORDER
- Lowered 3D border effect.
PLAIN
public static final int PLAIN
- Plain lines.
LEFT
public static final int LEFT
- Left justify the caption text.
CENTER
public static final int CENTER
- Center the caption text.
RIGHT
public static final int RIGHT
- Right justify the caption text.
Effect3D
public Effect3D()
- Construct an empty Effect3D. Effect3D.setComponent must be called
to set the component of this Effect3D before use.
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.
setComponent
public synchronized void setComponent(Component comp)
- Set the managed component of this Effect3D.
- Parameters:
- comp - managed component.
getComponent
public Component getComponent()
- Get the managed component of this Effect3D.
- Returns:
- managed component.
setStyle
public synchronized void setStyle(int style)
- Set the style of the 3D effect.
This method may cause a repaint.
- Parameters:
- style - 3D style.
getStyle
public int getStyle()
- Get the 3D effect style.
- Returns:
- the 3D effect style.
setBorder
public synchronized void setBorder(int border)
- Set the border width.
- Parameters:
- border - border width.
getBorder
public int getBorder()
- Get the border width.
- Returns:
- 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.
getCaption
public String getCaption()
- Get the caption string of this 3D box.
- Returns:
- caption string.
setCaptionPos
public synchronized void setCaptionPos(int pos)
- Set the caption position, left, center, or right. The default is left.
- Parameters:
- pos - caption position flag.
getCaptionPos
public int getCaptionPos()
- Get the caption position setting.
- Returns:
- caption position flag.
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
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
paint
public void paint(Graphics g)
- Paint 3D border and component.
- Parameters:
- g - Graphics content of this component.
- Overrides:
- paint in class Container
doLayout
public void doLayout()
- Layout the component.
- Overrides:
- doLayout in class Container
getChild
public Component getChild()
- Get the decorated component.
- Returns:
- component.
All Packages Class Hierarchy This Package Previous Next Index