Toggle your browser's Back and Forward buttons to compare the running applet to this code. |
Click here to run a fresh copy of the applet: SimpleApplet1.html |
/** USE EXISTING JAVA CLASSES **/
import java.awt.*;
import java.applet.Applet;
/** EXTEND THE JAVA APPLET CLASS **/
public class SimpleApplet1 extends Applet
{Font font = new Font("TimesRoman",Font.BOLD,30);
// Define and initialize a
// SimpleApplet1 class variable.
public void init()
{setBackground(Color.white);}
// Change the gray background to white.
/** CREATE THE CURRENT FRAME **/
public void paint(Graphics g)
{g.setFont(font);
g.setColor(Color.blue);
g.drawString("An applet
a day,",140,110);
g.drawString("keeps
Dr. Pais at bay.",140,150);
}
}