ciips.animation
Class ShadowLabel
java.lang.Object
ciips.animation.Drawable
ciips.animation.ShadowLabel
- All Implemented Interfaces:
- DrawingObj
- public class ShadowLabel
- extends Drawable
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:
DrawingPanel.removeObj(ciips.animation.DrawingObj)
Constructor Summary |
ShadowLabel(java.lang.String str)
Construct a new shadow label with the initial text string as
specified by the parameter. |
Method Summary |
void |
draw(java.awt.Graphics g)
Draw the text string with a gray label. |
java.awt.Font |
getFont()
|
java.lang.String |
getText()
Get the text string for this label object. |
void |
setColor(java.awt.Color col)
Set the text color of the drawing object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShadowLabel
public ShadowLabel(java.lang.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.
setColor
public void setColor(java.awt.Color col)
- Set the text color of the drawing object.
- Parameters:
col
- The new text color of the object.
getText
public java.lang.String getText()
- Get the text string for this label object.
- Returns:
- the text string for this label object.
getFont
public java.awt.Font getFont()
draw
public void draw(java.awt.Graphics g)
- Draw the text string with a gray label. This method is normally
called from the drawing panel paint method.
- Specified by:
draw
in interface DrawingObj
- Specified by:
draw
in class Drawable