All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.kcmultimedia.gifcanvas.GIFCanvas


java.lang.Object

   |

   +----java.awt.Component

           |

           +----java.awt.Canvas

                   |

                   +----com.kcmultimedia.gifcanvas.GIFCanvas


public class GIFCanvas
extends Canvas
implements Runnable
GIFCanvas is a class that permits display of animated GIF89a images (as well as static GIF89a images.) An extension of Canvas, GIFCanvas can be easily dropped into a layout, and several constructors are provided for loading images.


Constructor Index

 o GIFCanvas()
This no-argument constructor creates an empty GIFCanvas, sized 0x0.
 o GIFCanvas(byte[])
Creates a GIFCanvas displaying the image represented by the byte[] parameter.
 o GIFCanvas(File)
Creates a GIFCanvas displaying the image specified with the File parameter.
 o GIFCanvas(URL)
Creates a GIFCanvas displaying the image specified with the URL parameter.

Method Index

 o finalize()
Used to free graphics resources, flush image frames and try to be as well-behaved as possible.
 o getCurrentFrame()
Return an index to the currently displayed frame of the GIF, primarily for use by subclasses to perform some kind of special action depending on the frame that is visible.
 o isStopped()
Used to determine if the current animation loop is running.
 o minimumSize()
 o paint(Graphics)
 o preferredSize()
 o run()
 o setCurrentFrame(int)
Set the current frame index of the sequence, and repaint.
 o setImage()
Sets the image to null, effectively clearing the GIFCanvas
 o setImage(byte[])
Sets an image, represented by the byte array parameter of this method.
 o setImage(File)
Sets an image, represented by the File parameter of this method.
 o setImage(URL)
Sets an image, represented by the URL parameter of this method.
 o start()
Once an image is set, either in the constructor o by using a setImage method, calling start() starts the animation.
 o stop()
Calling this method stops the animation.
 o update(Graphics)

Constructors

 o GIFCanvas

 public GIFCanvas()

This no-argument constructor creates an empty GIFCanvas, sized 0x0.

 o GIFCanvas

 public GIFCanvas(URL url) throws Exception

Creates a GIFCanvas displaying the image specified with the URL parameter.

Parameters:
url - The URL of the image to be displayed.
Throws: Exception
thrown if the GIF file cannot be read or converted into an image.
 o GIFCanvas

 public GIFCanvas(File file) throws Exception

Creates a GIFCanvas displaying the image specified with the File parameter.

Parameters:
file - A File object representing the image to be displayed.
Throws: Exception
thrown if the GIF file cannot be read or converted into an image.
 o GIFCanvas

 public GIFCanvas(byte gifBytes[]) throws Exception

Creates a GIFCanvas displaying the image represented by the byte[] parameter.

Parameters:
gifBytes - A byte array representing the GIF's bytes.
Throws: Exception
thrown if the byte array cannot be converted into an image.

Methods

 o setImage

 public void setImage()

Sets the image to null, effectively clearing the GIFCanvas

 o setImage

 public void setImage(URL url) throws Exception

Sets an image, represented by the URL parameter of this method.

Parameters:
url - The URL of the image to be displayed.
Throws: Exception
thrown if the GIF file cannot be read or converted into an image.
 o setImage

 public void setImage(File file) throws Exception

Sets an image, represented by the File parameter of this method.

Parameters:
url - The File object representing the image to be displayed.
Throws: Exception
thrown if the GIF file cannot be read or converted into an image.
 o setImage

 public void setImage(byte byteArray[]) throws Exception

Sets an image, represented by the byte array parameter of this method.

Parameters:
byteArray - The byte array representing the image to be displayed.
Throws: Exception
thrown if the byte array cannot be converted into an image.
 o preferredSize

 public Dimension preferredSize()

Overrides:
preferredSize in class Component
 o minimumSize

 public Dimension minimumSize()

Overrides:
minimumSize in class Component
 o start

 public synchronized void start()

Once an image is set, either in the constructor o by using a setImage method, calling start() starts the animation.

 o stop

 public synchronized void stop()

Calling this method stops the animation.

 o run

 public final void run()

 o paint

 public synchronized void paint(Graphics g)

Overrides:
paint in class Canvas
 o update

 public void update(Graphics g)

Overrides:
update in class Component
 o finalize

 protected void finalize() throws Throwable

Used to free graphics resources, flush image frames and try to be as well-behaved as possible.

Throws: Throwable
[Need Description!]
Overrides:
finalize in class Object
 o getCurrentFrame

 public int getCurrentFrame()

Return an index to the currently displayed frame of the GIF, primarily for use by subclasses to perform some kind of special action depending on the frame that is visible.

 o setCurrentFrame

 public void setCurrentFrame(int num)

Set the current frame index of the sequence, and repaint. Forces GIFCanvas to display a particular frame of the animated GIF, possibly in response to some user action, intended for use by subclasses.

 o isStopped

 public boolean isStopped()

Used to determine if the current animation loop is running.

Returns:
true if stopped, false if running


All Packages  Class Hierarchy  This Package  Previous  Next  Index