Review
- It is worth starting by reviewing the aspects of Java
program structure you have been exposed to in class and in the
lab.
- Each program is constructed by completing a class
definition.
- A class definition consists of a class header followed
by a collection of
- variable declarations
- method definitions
grouped within curly braces.
- A method definition consists of a method header followed
by a list of statements grouped by curly braces.
- A methods name determines when the statements in the
method are preformed. In particular, the following names
associate instructions with user actions:
- onMousePress
- onMouseRelease
- onMouseClick
- onMouseEnter
- onMouseExit
- onMouseMove
- onMouseDrag
- begin
- There are (at least) three kinds of statements:
- constructions (new ... ),
- method invocations ( canvas.clear() ),
- assignments ( uptext = ... )