Tutorial 6: AWT GUI Programming, MVC


Introduction

This tutorial covers:


I. The Model: SodaMachine.class

Exercises:

  1. Copy the byte code of the class SodaMachine, ~comp212/tutorials/06/SodaMachine.class to your local directory:
  2. Look at the javadoc documentation for SodaMachine. Run SodaMachine to get an idea how the model behaves.
  3. Do the following only after you have built the GUI in part II: if time permits, write Java code to implement SodaMachine. Use StructureBuilder to reverse engineer if necessary.

II. The View: SodaGUI.class

Exercises:

  1. Copy the byte code of the class SodaGUI, ~comp212/tutorials/06/SodaGUI*.class to your local directory. Note: Do NOT compile SodaGUI.java. It is stub code so that the SodaControl will compile.
  2. Look at the javadoc documentation for SodaGUI. Run SodaGUI to get an idea how the view looks like.
  3. The given GUI is an incomplete GUI. Write Java code to implement SodaGUI as given. Use StructureBuilder to reverse engineer if necessary. Add hooks to install listeners for the appropriate components, which include but are not limited to:

    See today's handouts FLGUI Doc and FLGUI.java
  4. Add more components to the GUI to make it more "complete". NOTE: Dr. Java does not work with the java AWT so you need to use SB or emacs or whatever editor you use.

III. The Controller: SodaControl.java

Exercises:

  1. Review today's handouts FLGUI Doc and FLControl.java.
  2. Write the controller class SodaControl.java to glue the above model and view together.
D. X. Nguyen, Sept. 26, 1999.
dxnguyen@cs.rice.edu