Back to Applets page
Click in the boxes below, select all and copy to grab the applet
HTML listing:
<HTML> <HEAD> <TITLE>My First Applet</TITLE> </HEAD> <BODY BGCOLOR=WHITE> <APPLET CODEBASE="Classes" CODE="HelloWorld.class" WIDTH=400 HEIGHT=50> </APPLET> </BODY> </HTML>
Applet listing:
import java.awt.*; public class HelloWorld extends java.applet.Applet { Font f = new Font("TimesRoman",Font.BOLD,36); public void init() { setBackground(Color.white); } public void paint(Graphics g) { g.setFont(f); g.drawString("Hello, world!", 100 , 25); } }