AWT EXERCISES
The AWT Exercises represent the lab component of the AWT Short Course; the exercises lead you through the construction of a simple graphical interface called RegistrationForm and ask you to implement a number of techniques commonly used during GUI development. There are 24 exercises, 10 of which are directly used to construct RegistrationForm. See Exercise Help.
To complete the exercises, the following methodology is advisable:
-
Create a directory on your machine where you will place all of the Java and byte code files (.class).
Note: At the cost of having to set the CLASSPATH environment variable and some added complexity, you can place each solution in a separate directory. If you follow the suggested symbol-naming scheme, your class names will not conflict even if all your files are in the same directory.
-
Download RatioLayout.class into the directory you have created. You will need this layout manager for some of the exercises.
Note: Depending on your browser MIME type settings, simply clicking on the RatioLayout.class link may not force the browser to save the file (it may try to view the .class file). In most browsers, you can choose "Save Link As..." by clicking with the right mouse button.
-
You can download solution.zip or solution.tar, which contain the complete Java source for all Exercises as well as the .class files. Unzipping or untarring the files places the contents in the current directory. You can test your partial solution to the main exercise RegistrationForm by using some of the prepared .class files.
Note: Depending on your browser MIME type settings, simply clicking on the zip or tar file links may not force the browser to save the files (it may try to view them). In most browsers, you can choose "Save Link As..." by clicking with the right mouse button.
-
If you are using a Java development environment, create a project for each exercise because they are complete, executable applets. The project for the main RegistrationForm applet includes many of the other exercise Java files to form a working applet.
Begin the exercises at RegistrationForm,
which directs you to complete the other exercises required to build
the main applet--RegistrationForm. It is suggested that you read the
exercises from the top down, but code from the bottom up; in other words,
read the main exgercise, but code and test the subexercises first before
attempting RegistrationForm.
Each exercise has the following buttons:
- Expected behavior: Launches an applet illustrating the required behavior from your applet.
- Table of contents: Displays the table of contents for the course notes and the list of exercises.
- Help: Gives you help on the current exercise (an annotated solution).
- Solution: The <applet> tag and Java source resulting in the expected behavior.
For more information on exercises, see Exercise Help.
Note: If you want help on an individual and more personal basis, you can access the Java Developer Connection "Training Office Hours" when you can direct your questions online to the AWT Short Course instructor.
|