Copy the following to a filecalled Template.java. Compile it, than place the class in the samedirectory as your HTML file*************************/import java.awt.*;import java.applet.*;import java.util.*;import java.awt.event.*;public class Template extends Applet implements Runnable, KeyListener

{ //Some variables protected int refreshRate = 50; //how long each 'second' is in your game protected Thread thisThread; //This will handle our animations and general sequencing protected Graphics offscreen; //Allows double Buffering of painting graphics, see the paint(Graphics ) method //for more info protected Image offscreenImage; int x, y; /********************* Init is called when your applet is loaded. I start the thread here, but you may wish to start it elsewhere. (When the user presses a start button perhaps) *********************/ public void init()

{ startUp(); } public void startUp()

{ // //At this point you usually want to add the buttons, //textboxs or textfields // offscreenImage=createImage(bounds().width,bounds().height); offscreen=offscreenImage.getGraphics(); thisThread=new Thread(this); //initalizes our thread thisThread.start(); //calls the run function //these are for the moving message x=200; y=200; System.out.println("System Started"); } // //A mandatory function for applets, it is responsible for painting //graphics and pictures to the screen //DOUBLE BUFFERING //We will use a process where we paint to a canvas that is not visible, //than when we have painted everything we need, we show that canvas to the //user, wipe our old canvas off and start over. //this will reduce if not remove any annoying flickering that the user might //see. (Note this techinque is not proven, on some older machines the flickering //is still aparent) // public void paint(Graphics g)

{ // //wipe our old screen clean, by creating a large black rectangle on it // offscreen.setColor(Color.black); offscreen.fillRect(0,0,bounds().width,bounds().height); // //Draw a message // offscreen.setColor(Color.red); offscreen.drawString("Hello this is a message", x,y); //Paint the Message // //Now that we are done drawing on our old canvas, we will show the //finished image to our users. // g.drawImage(offscreenImage,0,0,this); } //Another mandatory function, not sure what difference this makes but if you don't have it //the screen flickers intermidently public void update(Graphics g)

{ //do some stuff here x--; try{thisThread.sleep(refreshRate);} //let screen catch up with the eyeballs catch(Exception e){} //you usually have changed the screen at this point so you may want to refresh it this.repaint(); } } public boolean isGameOver(){return false;} }