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 supports the following properties:
Property Name | Property Type | Description |
Delay | int |
Time delay in miniseconds between animation frames. |
Images | Image (Indexed) |
Animation frames for the Animator. |
-
Animator()
- Construct an empty Animator.
-
Animator(Image[])
- Create an Animator with the image array as the animation
frames.
-
getDelay()
- Get the delay in miniseconds between frames.
-
getImages()
- Get the animation frame images array.
-
paint(Graphics)
- Paint images of animation.
-
run()
- Run method of the Runnable interface.
-
setDelay(int)
- Set the delay between animation frames in miniseconds.
-
setImages(Image[])
- Set the animation frame images.
-
start()
- Start the animation sequence.
-
stop()
- Stop the animation sequence.
-
update(Graphics)
- Override default update() to avoid flickering.
Animator
public Animator()
- Construct an empty Animator. Animator.setImages() must be called
before this component can be used.
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.
getImages
public Image[] getImages()
- Get the animation frame images array.
- Returns:
- animation frames.
setImages
public void setImages(Image iv[])
- Set the animation frame images.
setDelay
public synchronized void setDelay(int d)
- Set the delay between animation frames in miniseconds.
- Parameters:
- d - delay between animation frames.
getDelay
public int getDelay()
- Get the delay in miniseconds between frames.
- Returns:
- current delay value.
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