All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.multimedia.Animator

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----symantec.itools.multimedia.Animator

public class Animator
extends Canvas
implements Runnable
This is a simple animation component.
It creates an animation by displaying a series of images in sequence. The programmer can specify the delay between frames in milliseconds. The animation can loop for a specific number of iterations or can run forever.


Variable Index

 o clearFrame
Clear frame between each image.
 o currentImage
Image currently being shown.
 o delay
Delay time between images, in milliseconds.
 o displayThread
Thread which runs the animation.
 o forever
Run animation forever.
 o images
Images to be displayed.
 o maxHeight
Dimension of largest image in sequence.
 o maxWidth
Dimension of largest image in sequence.
 o numLoops
Number of times to show the animation sequence.
 o previewMode
Preview this component at design time.

Constructor Index

 o Animator()
Constructs a default Animator.

Method Index

 o addImage(URL)
Adds an image to the animation set.
 o getClearFrame()
Gets the current clear frame setting.
 o getDelay()
Returns the current delay between animation frames.
 o getImageList()
Returns the image list.
 o getNumLoops()
Returns the current animation set loop count.
 o getPreviewMode()
Gets the preview mode flag.
 o getRepeatMode()
Returns the current repeat mode setting.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o run()
Body of Animation Thread.
 o setClearFrame(boolean)
Sets whether or not the animation frame area is cleared between each frame.
 o setDelay(int)
Sets the delay between animation frames.
 o setImageList(URL[])
Sets the image list.
 o setNumLoops(int)
Sets the number of loops to perform when displaying the animation set.
 o setPreviewMode(boolean)
Sets the preview mode flag.
 o setRepeatMode(boolean)
Sets the repeat mode setting.
 o startAnimation()
Starts the animation.
 o stopAnimation()
Stops the animation.
 o update(Graphics)
Handles redrawing of this component on the screen.

Variables

 o delay
  protected int delay
Delay time between images, in milliseconds.

 o numLoops
  protected int numLoops
Number of times to show the animation sequence.

 o forever
  protected boolean forever
Run animation forever. If false, use numLoops.

 o images
  protected Vector images
Images to be displayed.

 o currentImage
  protected Image currentImage
Image currently being shown.

 o displayThread
  protected Thread displayThread
Thread which runs the animation.

 o maxWidth
  protected int maxWidth
Dimension of largest image in sequence.

 o maxHeight
  protected int maxHeight
Dimension of largest image in sequence.

 o clearFrame
  protected boolean clearFrame
Clear frame between each image.

 o previewMode
  protected boolean previewMode
Preview this component at design time.

Constructors

 o Animator
  public Animator()
Constructs a default Animator. The animator defaults to a 500 millisecond delay, and loops forever.

Methods

 o setDelay
  public void setDelay(int i)
Sets the delay between animation frames.

Parameters:
i - animation delay, in milliseconds
See Also:
getDelay
 o getDelay
  public int getDelay()
Returns the current delay between animation frames.

Returns:
current animation delay, in milliseconds
See Also:
setDelay
 o setNumLoops
  public void setNumLoops(int i)
Sets the number of loops to perform when displaying the animation set.

Parameters:
i - loop count
See Also:
getNumLoops
 o getNumLoops
  public int getNumLoops()
Returns the current animation set loop count.

Returns:
loop count
See Also:
setNumLoops
 o setRepeatMode
  public void setRepeatMode(boolean b)
Sets the repeat mode setting.

Parameters:
b - repeat mode, repeats if true
See Also:
getRepeatMode
 o getRepeatMode
  public boolean getRepeatMode()
Returns the current repeat mode setting.

Returns:
current repeat mode setting, true if repeat forever
See Also:
setRepeatMode
 o addImage
  public synchronized void addImage(URL url)
Adds an image to the animation set.

Parameters:
url - URL of the image to add
 o setImageList
  public synchronized void setImageList(URL list[])
Sets the image list. Images in this list are displayed in sequence to form the animation.

Parameters:
list - array of image URLs
See Also:
getImageList
 o getImageList
  public synchronized URL[] getImageList()
Returns the image list.

Returns:
URL list of images
See Also:
setImageList
 o setClearFrame
  public void setClearFrame(boolean b)
Sets whether or not the animation frame area is cleared between each frame.

Parameters:
b - if true, the frame area is cleared between each animation frame; if false, the frame area is not cleared.
See Also:
getClearFrame
 o getClearFrame
  public boolean getClearFrame()
Gets the current clear frame setting.

Returns:
boolean - if true, the frame area is cleared between each animation frame; if false, the frame area is not cleared.
See Also:
setClearFrame
 o startAnimation
  public void startAnimation()
Starts the animation.

See Also:
stopAnimation
 o stopAnimation
  public void stopAnimation()
Stops the animation.

See Also:
startAnimation
 o setPreviewMode
  public void setPreviewMode(boolean f)
Sets the preview mode flag. This flag is used by Visual Cafe to determine if this component should be run during design time.

Parameters:
f - new preview mode
See Also:
getPreviewMode
 o getPreviewMode
  public boolean getPreviewMode()
Gets the preview mode flag. This flag is used by Visual Cafe to determine if this component should be run during design time.

Parameters:
f - new preview mode
See Also:
setPreviewMode
 o run
  public synchronized void run()
Body of Animation Thread. This method is called by the Java Virtual Machine in response to a call to the start method of this object.

 o paint
  public synchronized void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o update
  public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to make clearing the background before painting optional. If the clearFrame flag is true the background will be erased before painting begins.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o preferredSize
  public Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Returns:
If no images have been loaded, a dimension of 10 by 10 is returned. If one or more images have been loaded, the largest height and the largest width of any image is returned.
Overrides:
preferredSize in class Component
See Also:
minimumSize
 o minimumSize
  public Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Returns:
If no images have been loaded, a dimension of 10 by 10 is returned. If one or more images have been loaded, the largest height and the largest width of any image is returned.
Overrides:
minimumSize in class Component
See Also:
preferredSize

All Packages  Class Hierarchy  This Package  Previous  Next  Index