Class tea.set.Animator
All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.Animator
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----tea.set.ImageCanvas
|
+----tea.set.Animator
- public class Animator
- extends ImageCanvas
- implements Runnable
Animator displays a series of animation images in a Canvas area.
The rate of the animation
can be controlled by setting the delay between frames by
using setDelay() method. The default size of the Animator is the
size of the first image in the animation sequence. All other
images are scaled to the same size as the first image. If the
Animator is resized to a size other than the default size,
all images are scaled to be the same size as the widget itself.
-
Animator(Image[])
- Create an Animator with the image array as the animation
frames.
-
Animator(Vector)
- Create an Animator with the image vector as the animation
frames.
-
paint(Graphics)
- Paint images of animation.
-
run()
- Run method of the Runnable interface.
-
setDelay(int)
- Set the delay between animation frames in miniseconds.
-
start()
- Start the animation sequence.
-
stop()
- Stop the animation sequence.
-
update(Graphics)
- Override default update() to avoid flickering.
Animator
public Animator(Image iv[])
- Create an Animator with the image array as the animation
frames.
- Parameters:
- iv - an array of java.awt.Image for animation frames.
Animator
public Animator(Vector iv)
- Create an Animator with the image vector as the animation
frames.
- Parameters:
- iv - a vector of java.awt.Image for animation frames.
setDelay
public void setDelay(int d)
- Set the delay between animation frames in miniseconds.
- Parameters:
- d - delay between animation frames.
start
public void start()
- Start the animation sequence. Repeated call to this method will
be ignored. The animation sequence does not end until an
explicit call to stop() is made.
stop
public void stop()
- Stop the animation sequence. The current thread is stopped and
destroyed. The next call to start() will create a new thread
to run the animation.
paint
public synchronized void paint(Graphics g)
- Paint images of animation.
- Parameters:
- g - Graphics content of this component.
- Overrides:
- paint in class ImageCanvas
update
public void update(Graphics g)
- Override default update() to avoid flickering.
- Parameters:
- g - Graphics content of this component.
- Overrides:
- update in class Component
run
public synchronized void run()
- Run method of the Runnable interface. This is the animation
main loop.
All Packages Class Hierarchy This Package Previous Next Index