Class AnimationPanel
Class AnimationPanel
AnimationPanel
- class AnimationPanel
- extends Panel
- implements Runnable
A class for containing, laying out and animating a
collection of animations. Lays animations out in a 10 by 10
grid, and animates by calling updateNextImage
against every animation in its collection.
-
AnimationPanel()
- Constructor - Create a Vector for holding the animations,
and set us up as with a grid layout 10 by 10.
-
addAnimation(Animation)
- Add an animation to this panel.
-
replaceAnimation(int, Animation)
- Replace the Animation at the specified index with the
supplied Animation.
-
run()
- Our threads run method - sits in an infinite loop, sleeping
for 1/3 of a second, then running through all the Animations in
our Vector of Animations setting them to the next image in the
sequence and telling them to repaint.
AnimationPanel
public AnimationPanel()
- Constructor - Create a Vector for holding the animations,
and set us up as with a grid layout 10 by 10.
addAnimation
public int addAnimation(Animation an)
- Add an animation to this panel. Adds the Animation
Component to this Container, relays-out the Container and adds
the Animation to our Vector of Animations. Called only when a
new Agent reports in. Agent state changes are handled by
replaceAnimation.
- Returns:
- The number of animations in this Panel.
replaceAnimation
public void replaceAnimation(int index,
Animation ani)
- Replace the Animation at the specified index with the
supplied Animation. Removes the Animations Component from this
Container, removes the Animation itself from our Vector of
Animations, hides the Component, shows the new Animation and
re-lays-out this Container.
run
public void run()
- Our threads run method - sits in an infinite loop, sleeping
for 1/3 of a second, then running through all the Animations in
our Vector of Animations setting them to the next image in the
sequence and telling them to repaint.