1 | 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. |
2 | Import java.awt.Graphics; |
3 | public class HelloWorldApplet extends java.applet.Applet |
4 | { public void paint(Graphics g) |
5 | { g.drawString("Hello World!",5,25); } |
6 | } |
7 | The paint method displays a graphics object on the screen |
8 | one of the standard methods that replaces main for applets |
9 | The import statement is similar to an include and makes all the method |
10 | names in the Graphics class in the awt package available |
11 | Puts this as a subclass of Applet |
12 | Drawstring is one of many |
13 | available display methods |