CS 12 -- Lab 10

Let's do a bit of graphical user interface (GUI) programming.


Die: An example

We will begin with a simple example of a Java GUI applet.

  1. Grab the following two files from my public directory:
    ~sfkaplan/public/cs12/Die.java
    ~sfkaplan/public/cs12/Die.html
  2. Examine both files -- we will discuss the structure of the Java source code.
  3. Compile the Java source in the normal fashion.
  4. You can run the applet using the following command:
    appletviewer Die.html

Dice: Extending the example

Given the example above, alter it to have two Die, with one button for each. Specifically, name it Dice (thus creating Dice.html and Dice.java files). The dice should appear separately within the window, and clicking the button associated with a particular die should change the value of that die.


Graphical Game of Life

Use your existing Life code from Project 2, and give it a pretty face. You should provide one button that initializes (or resets to) the 0th generation, and another button that evolves to the next step. The cells should be drawn in a grid, and the color should indicate the liveliness of each cell. Pick different colors for different cell types.


What you must submit

Submit your Dice files and your graphical Life files. Include all files needed to run the applets. Submit this work at lab-10.


This assignment is due on Wednesday, December 10th, at 5 pm.

Scott F. Kaplan
Last modified: Sun Nov 5 22:48:52 EST 2000