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:
/* This is my first applet Here we show how to change the font style */ import java.applet.*; import java.awt.*; public class HelloWorld extends Applet { Font f = new Font("TimesRoman",Font.ITALIC,36); public void init() { setBackground(Color.white); } public void paint(Graphics g) { g.setFont(f); g.drawString("Now in Italics", 100 , 25); } }