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.

Constructor Index

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

Method Index

 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 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(Image iv[])
Create an Animator with the image array as the animation frames.
Parameters:
iv - an array of java.awt.Image for animation frames.
 o 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.

Methods

 o setDelay
  public void setDelay(int d)
Set the delay between animation frames in miniseconds.
Parameters:
d - delay between animation frames.
 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