``Hello, World'' Applet

Applet is the small program, that can work inside a WWW-page. It uses a rectangle inside a page for drawing, user input etc. Below you see the output of "Hello, World" applet:

:-( You should run some Java-enabled browser to see the output of applet.

Here is the text of ``Hello, World!'' applet:
import java.awt.*;
import java.applet.Applet;

public class HelloWorld extends Applet {
    Font myFont = new Font("TimesRoman", Font.BOLD, 24);

    public void paint(Graphics g) {
        g.setFont(myFont);
        g.setColor(Color.blue);
        g.drawString("Hello, World!", 20, 30);
    }
}
The following text must be used to insert applet into html-page:
<center>
<applet code="HelloWorld.class" width=300 height=40>
You should run some Java-enabled browser to see the
output of applet...
</applet>
</center>
Look to the Java Tutorial for details.