|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbecker.robots.icons.Icon
becker.robots.icons.CompositeIcon
becker.robots.icons.AnimatedIcon
public class AnimatedIcon
An AnimatedIcon displays a sequence of icons, giving the appearance of movement or action. For example, an object representing a flashing light might use an AnimatedIcon with two icons -- one icon with the light on and one icon with the light off. More complicated sequences are also possible.
Field Summary |
---|
Fields inherited from class becker.robots.icons.Icon |
---|
transparent |
Constructor Summary | |
---|---|
AnimatedIcon(Sim owner,
Icon[] icons,
int millisecondsForEachIcon)
Construct an AnimatedIcon which displays the Icons in the given array in order. |
Method Summary | |
---|---|
Color |
getColor()
Returns null. |
Image |
getImage(int width,
int height,
double rotation)
Get the image for the current icon. |
protected void |
renderImage(Graphics2D g2,
int width,
int height)
Render the image for the current icon. |
void |
setColor(Color c)
Has no effect. |
protected void |
setCurrentImage(int imageNum)
Set which image is currently shown. |
void |
start()
Start the animation. |
void |
stop()
Stop the animation. |
Methods inherited from class becker.robots.icons.CompositeIcon |
---|
applyTransforms, componentIcon, hasChanged, markChanged, numComponents |
Methods inherited from class becker.robots.icons.Icon |
---|
getLabel, getRotation, getSize, getTransparency, paintIcon, setLabel, setSize, setTransparency |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnimatedIcon(Sim owner, Icon[] icons, int millisecondsForEachIcon)
owner
- the Sim which will be displaying this icon.icons
- the Icons to show, in sequence.millisecondsForEachIcon
- how long to show each icon.Method Detail |
---|
public void start()
public void stop()
protected void setCurrentImage(int imageNum)
imageNum
- The index of the image to show. 0 <= imageNum < icons.lengthprotected void renderImage(Graphics2D g2, int width, int height)
renderImage
in class CompositeIcon
g2
- the graphics context where the icon should be drawn.width
- the number of pixels wide the image will beheight
- the number of pixels high the image will bepublic Image getImage(int width, int height, double rotation)
getImage
in class Icon
public Color getColor()
Color c = animatedIcon.componentIcon(0).getColor();
getColor
in class CompositeIcon
public void setColor(Color c)
Color c = animatedIcon.componentIcon(0).setColor(newColor);
setColor
in class CompositeIcon
c
- The new color.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |