|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ciips.animation.ShadowLabel
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):
This object can be removed from the drawing panel by using the
ShadowLabel helloLabel = new ShadowLabel("Hello");
drawingPanel.addDrawingObj(helloLabel);
helloLabel.move(100, 100);
helloLabel.setColor(Color.blue);
drawingPanel.redraw();
removeObj
method from DrawingPanel
.
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. |
int |
getX()
Get the left most positionn of the shadow label. |
int |
getY()
Get the bottom most positionn of the shadow label. |
void |
move(int x,
int y)
Move this shadow label to the new position with its bottom left corner specified by the paramters. |
void |
setColor(java.awt.Color col)
Set the text color of the drawing object. |
void |
setText(java.lang.String str)
Set the text string for this drawing object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ShadowLabel(java.lang.String str)
str
- The initial text string for this shadow label.Method Detail |
public void setColor(java.awt.Color col)
col
- The new text color of the object.public void setText(java.lang.String str)
str
- The new text string for label object.public java.lang.String getText()
public int getX()
getX
in interface DrawingObj
public int getY()
getY
in interface DrawingObj
public java.awt.Font getFont()
public void move(int x, int y)
move
in interface DrawingObj
x
- The left most position of the shadow label.y
- The bottom most position of the shadow label.public void draw(java.awt.Graphics g)
draw
in interface DrawingObj
ciips.animation.DrawingObj
g
- A reference to the graphical context.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |