Basic HTML version of Foils prepared June 5 99

Foil 12 A simple Java applet - Hello World!

From Java Language in the Computer Science Curriculum ADMI Tutorial Duluth Minnesota -- June 3 99. by Geoffrey C. Fox


1 import java.awt.Graphics;
2 public class HelloApplet extends java.applet.Applet
3 { public void paint (Graphics g)
4 { g.drawString("Hello World!", 5, 25);
5 }
6 }
7 The import statement allows the use of Graphics methods
8 The paint method uses graphics methods like drawString to draw objects on the window
9 You name the applet here.
10 The applet is a program with methods, like paint, that are called by the browser to draw in the window. This applet displays the string "Hello World!"

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Jun 5 1999