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 |
} |
. . . } |