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