Class ShadowLabel

java.lang.Object
   |
   +----ShadowLabel

public class ShadowLabel
extends Object
implements DrawingObj
This is another example implementation of the DrawingObj interface. This particular class enables a test string to be displayed on the drawing panel with a shadowing effect. For example, the following lines initializes an instance of this class and display a text string "Hello" on the drawing panel with blue text color and gray shadow at position (100, 100):
	ShadowLabel helloLabel = new ShadowLabel("Hello");
	drawingPanel.addDrawingObj(helloLabel);
	helloLabel.move(100, 100);
	helloLabel.setColor(Color.blue);
	drawingPanel.redraw();
 
This object can be removed from the drawing panel by using the removeObj method from DrawingPanel.

See Also:
removeObj

Constructor Index

 o ShadowLabel(String)
Construct a new shadow label with the initial text string as specified by the parameter.

Method Index

 o draw(Graphics)
Draw the text string with a gray label.
 o getText()
Get the text string for this label object.
 o getX()
Get the left most positionn of the shadow label.
 o getY()
Get the bottom most positionn of the shadow label.
 o move(int, int)
Move this shadow label to the new position with its bottom left corner specified by the paramters.
 o setColor(Color)
Set the text color of the drawing object.
 o setText(String)
Set the text string for this drawing object.

Constructors

 o ShadowLabel
 public ShadowLabel(String str)
Construct a new shadow label with the initial text string as specified by the parameter.

Parameters:
str - The initial text string for this shadow label.

Methods

 o setColor
 public void setColor(Color col)
Set the text color of the drawing object.

Parameters:
col - The new text color of the object.
 o setText
 public void setText(String str)
Set the text string for this drawing object.

Parameters:
str - The new text string for label object.
 o getText
 public String getText()
Get the text string for this label object.

Returns:
the text string for this label object.
 o getX
 public int getX()
Get the left most positionn of the shadow label.

Returns:
the x-coordinate of the bottom left corner of the shadow label.
 o getY
 public int getY()
Get the bottom most positionn of the shadow label.

Returns:
the y-coordinate of the bottom left corner of the shadow label.
 o move
 public void move(int x,
                  int y)
Move this shadow label to the new position with its bottom left corner specified by the paramters.

Parameters:
x - The left most position of the shadow label.
y - The bottom most position of the shadow label.
 o draw
 public void draw(Graphics g)
Draw the text string with a gray label. This method is normally called from the drawing panel paint method.