First the applet must create a new instance of the class. Note that the class name is used like a type (just like the built-in Java class names). Drawarea drawing = new Drawarea ( ); This executes the constructor, doing the initialization. |
Now the applet can refer to variables in the class (e.g. x) using the dot notation with the instance, drawing: drawing.x = 10; |
and use methods from the class: drawing.paint ( g ); |