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


In the same file as the applet, you can define another class.
It should have variables, a constructor method of the same name, and any other methods, such as paint.
class Drawarea extends Canvas
{ //declare variables here
int x;
// this method is the constructor
public Drawarea ( )
{
// do initialization stuff here
}
public void paint ( Graphics g )
{
// call drawing methods here
}
. . . }



© 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