Setting up Applet and Thread Objects
//******************************************************************************
// Javamation.java: An Applet that plays a series of animation frames and sound
// specified in the HTML page that calls the applet.
//******************************************************************************
import java.applet.*;
import java.awt.*;
//==============================================================================
// Main Class for applet Javamation
//
//==============================================================================
public class Javamation extends Applet implements Runnable
{
// m_Javamation is the Thread object for the applet
private Thread m_Javamation = null;
// The following variables are used to store the values of the
// parameters.
private int m_fps = 5;
private int m_numImages = 21;
private String m_imageFile = "pg_a";
// Parameter names.
private final String PARAM_fps = "fps";
private final String PARAM_numImages = "numImages";
private final String PARAM_imageFile = "imageFile";
// Use a mediatracker to monitor image file loading
MediaTracker m_mediaTracker = new MediaTracker(this);
// variables to store frame information
int m_nFrameNumber = 0;
Image m_frame[];
Learn More
The complete applet source code.