// This example is from the book "Java in a Nutshell, Second Edition". // Written by David Flanagan. Copyright (c) 1997 O'Reilly & Associates. // You may distribute this source code for non-commercial purposes only. // You may study, modify, and use this example for any purpose, as long as // this notice is retained. Note that this example is provided "as is", // WITHOUT WARRANTY of any kind either expressed or implied. import java.applet.*; // Don't forget this import statement! import java.awt.*; // Or this one for the graphics! public class FirstApplet extends Applet { // This method displays the applet. // The Graphics class is how you do all drawing in Java. public void paint(Graphics g) { /* EK: paint is a method in Component and Container (Java 1.1) both of which are superclasses of Applet. paint() is invoked by the Java VM to draw into the Component when it becomes visible; the system provides a Graphics interface for painting, e.g., writing a String */ g.setFont(new Font("TimesRoman", Font.BOLD+Font.ITALIC, 24)); g.drawString("Hello World", 25, 50); super.paint(g); // EK: as to jdoc } }