Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class uk.co.ist.mwt.ShadowDrawer

java.lang.Object
  |
  +--uk.co.ist.mwt.ShadowDrawer

public class ShadowDrawer
extends java.lang.Object
A ShadowDrawer is a class which knows how to draw shadows; a component owns one and uses it for this purpose.


Constructor Summary
ShadowDrawer()
          Constructs a ShadowDrawer which draws shadows of the default thickness (zero)
ShadowDrawer(int thickness)
          Constructs a ShadowDrawer which draws shadows of a particular thickness
 
Method Summary
void draw3DRect(java.awt.Component c, java.awt.Rectangle r, boolean in)
          A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw.
void draw3DRect(java.awt.Graphics g, java.awt.Component c, java.awt.Rectangle r, boolean in)
          A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw.
void drawShadow(java.awt.Component c, int x, int y, int length, boolean vertical, boolean reflect, boolean top)
          Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
void drawShadow(java.awt.Graphics g, java.awt.Component c, int x, int y, int length, boolean vertical, boolean reflect, boolean top)
          Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
java.awt.Color getBottomShadowColor(java.awt.Component c)
          Gets the color for 'bottom shadows' - those which suggest an area in shadow
int getShadowThickness()
          Gets the thickness this drawer is using for shadows right now
java.awt.Color getTopShadowColor(java.awt.Component c)
          Gets the color for 'top shadows' - ie. those which suggest sides which are getting more than their fair share of light.
void setBottomShadowColor(java.awt.Color c)
          Sets the color for 'bottom shadows' - those which suggest an area in shadow
void setShadowThickness(int shadowThickness)
          Sets the thickness this drawer is using for shadows right now
void setTopShadowColor(java.awt.Color c)
          Sets the color for 'top shadows' - ie. those which suggest sides which are getting more than their fair share of light.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

ShadowDrawer

public ShadowDrawer()
Constructs a ShadowDrawer which draws shadows of the default thickness (zero)

ShadowDrawer

public ShadowDrawer(int thickness)
Constructs a ShadowDrawer which draws shadows of a particular thickness
Method Detail

setTopShadowColor

public void setTopShadowColor(java.awt.Color c)
Sets the color for 'top shadows' - ie. those which suggest sides which are getting more than their fair share of light.

getTopShadowColor

public java.awt.Color getTopShadowColor(java.awt.Component c)
Gets the color for 'top shadows' - ie. those which suggest sides which are getting more than their fair share of light.
Parameters:
c - a component to use for a default value if none has been set

setBottomShadowColor

public void setBottomShadowColor(java.awt.Color c)
Sets the color for 'bottom shadows' - those which suggest an area in shadow

getBottomShadowColor

public java.awt.Color getBottomShadowColor(java.awt.Component c)
Gets the color for 'bottom shadows' - those which suggest an area in shadow
Parameters:
c - a component to use for a default value if none has been set

getShadowThickness

public int getShadowThickness()
Gets the thickness this drawer is using for shadows right now

setShadowThickness

public void setShadowThickness(int shadowThickness)
Sets the thickness this drawer is using for shadows right now

drawShadow

public void drawShadow(java.awt.Component c,
                       int x,
                       int y,
                       int length,
                       boolean vertical,
                       boolean reflect,
                       boolean top)
Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
  /~~~~~~~~~~~\
  ~~~~~~~~~~~~~
 
where the slashes are meant to be at 45 degrees, and the height is the shadow thickness. The /length/ parameter determines the longest side's length. The above would be drawn with /vertical/ equal to false and /reflect/ = false. Setting /vertical/ to true would rotate it 90 degrees clockwise. The effect of reflect=true is to reflect the shape in its longest axis. If /top/, the top shadow colour is used; otherwise the bottom shadow is.

drawShadow

public void drawShadow(java.awt.Graphics g,
                       java.awt.Component c,
                       int x,
                       int y,
                       int length,
                       boolean vertical,
                       boolean reflect,
                       boolean top)
Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
  /~~~~~~~~~~~\
  ~~~~~~~~~~~~~
 
where the slashes are meant to be at 45 degrees, and the height is the shadow thickness. The /length/ parameter determines the longest side's lenght. The above would be drawn with /vertical/ equal to false and /reflect/ = false. Setting /vertical/ to true would rotate it 90 degrees clockwise. The effect of reflect=true is to reflect the shape in its longest axis. If /top/, the top shadow colour is used; otherwise the bottom shadow is.

draw3DRect

public void draw3DRect(java.awt.Component c,
                       java.awt.Rectangle r,
                       boolean in)
A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw. /in/ determines whether the rectangle is sunken in or extrudes outwards.

draw3DRect

public void draw3DRect(java.awt.Graphics g,
                       java.awt.Component c,
                       java.awt.Rectangle r,
                       boolean in)
A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw. /in/ determines whether the rectangle is sunken in or extrudes outwards.

Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD