Next, the following is the main program of the APPLET:
Public class MyClock extends Applet implements Runnable
{
Static final int BACKGROUND = 0; // the serial number of the BACKGROUND image for Array use
Static final int LOGO = 1; // the serial number of the LOGO image for Array use
Static final String JAVEX = "bear"; // text displayed on the dial
Static final double MINSEC = 0.104719755; // The radian between the probe and second-pin on the dial (60)
Static final double HOUR = 0.523598776; // The radian of the HOUR hand on the dial (24)
Thread clockThread = null; // use the multi-Thread mechanism to continuously display images with another Thread
// Provides the default parameters. If no parameters are provided in the HTML file, use
Int width = 100;
Int height = 100;
Color bgColor = new Color (0, 0 );
Color faceColor = new Color (0, 0 );
Color sweepColor = new Color (255, 0, 0 );
Color minuteColor = new Color (192,192,192 );
Color hourColor = new Color (255,255,255 );
Color textColor = new Color (255,255,255 );
Color caseColor = new Color (0, 0 );
Color trimColor = new Color (192,192,192 );
String logoString = null;
Image images [] = new Image [2]; // Image of the background and LOGO
Boolean isPainted = false; // if the background and dial are drawn during the first loading, only the pointer is drawn when the painting is re-painted at other times.
// The center of the clock
Int x1, y1;
// Coordinates of the scale chart of the triangle at the top
Int xPoints [] = new int [3], yPoints [] = new int [3];