All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.Shade
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----tea.set.Shade
- public class Shade
- extends Panel
- implements Decorator
Shade class is a decorator class to add a shade to an AWT component.
When Shade class is constructed, a component must be passed in to
be shaded. The shade width can be controled by setShadeWidth()
function. The default behavior of Shade addes a border to the
component being shaded. It can be turned off by using
Shade(Component,boolean) constructor, or by calling setBorder()
method.
Shade supports the following properties:
Property Name | Property Type | Description |
Component | Component |
The shaded component. |
Border | boolean |
True to draw a border around child component. |
ShadeWidth | int |
The width of the shade in pixels. |
-
Shade()
- Construct an empty Shade.
-
Shade(Component)
- Construct a shaded component.
-
Shade(Component, boolean)
- Construct a shaded component and draw border according to the
border flag.
-
getChild()
- Get the decorated component.
-
getComponent()
- Get the managed component.
-
getMinimumSize()
- Minimum size is the minimum size of the component increased
by the shade and border width.
-
getPreferredSize()
- Preferred size is the preferred size of the component increased
by the shade and border width.
-
getShadeWidth()
- Get shadow width.
-
isBorder()
- Get the border option of this Shade.
-
paint(Graphics)
- Paint the component with a shade.
-
setBorder(boolean)
- Set border option to true or false.
-
setComponent(Component)
- Set the managed component of this Shade.
-
setShadeWidth(int)
- Set the shade width.
Shade
public Shade()
- Construct an empty Shade. Shade.setComponent() must be called to
set the shaded component.
Shade
public Shade(Component comp)
- Construct a shaded component. Border option defaults to true.
- Parameters:
- comp - component to add shade to.
Shade
public Shade(Component comp,
boolean border)
- Construct a shaded component and draw border according to the
border flag.
- Parameters:
- comp - component to add shade to.
- border - draw border if true.
setComponent
public synchronized void setComponent(Component comp)
- Set the managed component of this Shade.
- Parameters:
- comp - managed component.
getComponent
public Component getComponent()
- Get the managed component.
- Returns:
- managed component.
setBorder
public synchronized void setBorder(boolean border)
- Set border option to true or false. If border option is true, a
light border is draw around the component to highlight it.
- Parameters:
- border - draw border if true.
isBorder
public boolean isBorder()
- Get the border option of this Shade.
- Returns:
- true if border option is true.
getShadeWidth
public int getShadeWidth()
- Get shadow width.
- Returns:
- shadow width.
setShadeWidth
public synchronized void setShadeWidth(int shadeW)
- Set the shade width. Default width is 5 pixels.
- Parameters:
- shadeW - shade width.
paint
public void paint(Graphics g)
- Paint the component with a shade.
- Parameters:
- g - Graphics context of this component.
- Overrides:
- paint in class Container
getPreferredSize
public Dimension getPreferredSize()
- Preferred size is the preferred size of the component increased
by the shade and border width.
- Returns:
- preferred size.
- Overrides:
- getPreferredSize in class Container
getMinimumSize
public Dimension getMinimumSize()
- Minimum size is the minimum size of the component increased
by the shade and border width.
- Returns:
- minimum size.
- Overrides:
- getMinimumSize in class Container
getChild
public Component getChild()
- Get the decorated component.
- Returns:
- component.
All Packages Class Hierarchy This Package Previous Next Index