Basic HTML version of Foils prepared March 26 1999

Foil 15 Defining another class

From Java Academy:Graphical User Interface NPAC Java Academy February--April 99 -- March 1999. by Nancy McCracken


1 In the same file as the applet, you can define another class.
2 It should have variables, a constructor method of the same name, and any other methods, such as paint.
3 class Drawarea extends Canvas
4 { //declare variables here
5 int x;
6 // this method is the constructor
7 public Drawarea ( )
8 {
9 // do initialization stuff here
10 }
11 public void paint ( Graphics g )
12 {
13 // call drawing methods here
14 }
15 . . . }

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 Fri Mar 26 1999