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 NameProperty TypeDescription
Delayint Time delay in miniseconds between animation frames.
ImagesImage (Indexed) Animation frames for the Animator.


Constructor Index

 o Animator()
Construct an empty Animator.
 o Animator(Image[])
Create an Animator with the image array as the animation frames.

Method Index

 o getDelay()
Get the delay in miniseconds between frames.
 o getImages()
Get the animation frame images array.
 o paint(Graphics)
Paint images of animation.
 o run()
Run method of the Runnable interface.
 o setDelay(int)
Set the delay between animation frames in miniseconds.
 o setImages(Image[])
Set the animation frame images.
 o start()
Start the animation sequence.
 o stop()
Stop the animation sequence.
 o update(Graphics)
Override default update() to avoid flickering.

Constructors

 o Animator
 public Animator()
Construct an empty Animator. Animator.setImages() must be called before this component can be used.

 o 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.

Methods

 o getImages
 public Image[] getImages()
Get the animation frame images array.

Returns:
animation frames.
 o setImages
 public void setImages(Image iv[])
Set the animation frame images.

 o setDelay
 public synchronized void setDelay(int d)
Set the delay between animation frames in miniseconds.

Parameters:
d - delay between animation frames.
 o getDelay
 public int getDelay()
Get the delay in miniseconds between frames.

Returns:
current delay value.
 o 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.

 o 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.

 o paint
 public synchronized void paint(Graphics g)
Paint images of animation.

Parameters:
g - Graphics content of this component.
Overrides:
paint in class ImageCanvas
 o update
 public void update(Graphics g)
Override default update() to avoid flickering.

Parameters:
g - Graphics content of this component.
Overrides:
update in class Component
 o 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