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


import java.awt.Graphics;
public class HelloApplet extends java.applet.Applet
{ public void paint (Graphics g)
{ g.drawString("Hello World!", 5, 25);
}
}
The import statement allows the use of Graphics methods
The paint method uses graphics methods like drawString to draw objects on the window
You name the applet here.
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!"



© 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