Applet details, Variables

Tom Kelliher, CS 116

Sept. 9, 2002



Postlabs due when?


From Last Time

Lab 2.


  1. Applet methods.

  2. Variables.

  3. Exercise.

Coming Up

Applet Methods

  1. public void init() { ... } is executed exactly one time when an applet is first created. It is commonly used for setting the colors in the applet and adding the widgets into the applet.

  2. public void paint(Graphics g) { ... } is executed every time the applet needs to be redrawn on the screen.


  1. Local variables are declared inside a method and can only be used inside that method.

  2. Instance variables are declared outside of the class methods and can be used in any of the methods.

  3. Class variables are declared with the keyword static and are part of the class rather than part of an object. They are used by:

Exercise with Variables

Thomas P. Kelliher
Thu Sep 5 07:34:21 EDT 2002
Tom Kelliher