Java applets are part of the class hierarchy that can call methods to display on a screen (within the browser window). This example defines the public method paint in this class and calls a method drawString defined in the class Graphics. |
import java.awt.Graphics; |
public class HelloWorldApplet extends java.applet.Applet |
{ public void paint(Graphics g) |
{ g.drawString("Hello World!",5,25); } |
} |
The paint method displays a graphics object on the screen |
one of the standard methods that replaces main for applets |
The import statement is similar to an include and makes all the method |
names in the Graphics class in the awt package available |
Puts this as a subclass of Applet |
Drawstring is one of many |
available display methods |