Day 3 Lab Exercises
June 27, 1997






  1. (a) Find the source code for the class java.awt.graphics to find what drawing methods are available in addition to drawLine and drawRect that were used to draw the stick figure. It is important to know how to locate the JDK source code as it is often the best source of information about these programs. Once the master java directory is located on your machine, the source code is normally found in various subdirectories of the directory java-master-directory/src/java/.

    Use some of the methods in a program to draw other figures, e.g., a stick figure with an oval body. Also see Late Night Java, pp. 101-103, for more information on Graphics methods for drawing shapes. The source code for the stick figure example is available.

    (b) Use the information in the section Working with Colors (pp. 100-101) to draw your figures in one or more different colors.

  2. Read the material on pp. 90-92 of Late Night Advanced Java and use the example programs from chapter 5 as a guide to write new programs to display windows similar to those in Figures 5.8 and 5.9 on pages 90 and 91.

  3. Add another button and counter to the HitMiss program or alter version 2 of HitMiss.