last updated: Wed Apr 4

Spring 2002
Homework #5
due TUE Apr 16, by 6AM -- electronic submission

hardcopy due IN CLASS: 11.05AM cs1007-002; 2.45PM cs1007-001

The goals of this assignment are to:

  1. implement an applet
  2. build a graphical user interface
  3. learn how to use Java graphics

You need to modify the GUI example from class as follows:

  1. include at least 4 of the following GUI components: Button, Checkbox, Choice, Label, List, TextArea, TextField
  2. additionally, you must include a Canvas
  3. at least 3 of the components must be attached to some type of behavior in the applet and you must handle events using a listener interface (i.e., clicking on a button must do something visible in the applet)
  4. use any layout manager except FlowLayout (BorderLayout is fine)
  5. include at least 5 of the following AWT drawing primitives in the Canvas: drawString, drawLine, drawRect, drawOval, drawArc, fillRect, fillOval, fillArc
  6. be CREATIVE!!!

The working applets will be posted in a gallery on the class web page.

Your assignment will consist of:

You can use the examples from class as the basis for your assignment, but you MUST change the example(s) significantly in terms of the components used and the drawing done. Check the syllabus web page for code from the Apr 2 and Apr 4 lectures.

source code.
Your source code (i.e., your .java file) but be neat and clearly commented. You must have a header comment and you should comment the end of each block (i.e., each }). You need to comment each method that you write within each class.

Follow the submission instructions carefully!!! If you don't, human intervention will be required to fix your mistakes, and you will lose 0.5 points.

  1. Name your homework files properly.
    You will submit (at least) 2 files:
    1. hw5<yourCUNIXusername>.java
      For example, mine is called
    2. hw5<yourCUNIXusername>.html
      For example, mine is called hw5eis2003.html.

  2. Submit your files electronically.
    You need to turn in ALL the Java source code, Follow instructions on the assignments page.

  3. Turn in a harcopy of your program during THE FIRST 5 MINUTES OF class.
    Print out the homework template cover page ( and fill it out.
    Staple the cover page to a hardcopy (print-out) of your program. You need to turn in ALL the Java source code and the HTML file. Make sure your name is on all the papers you hand in!
    Bring the cover page and hardcopy to class on the day the assignment is due and deposit it in the homework box at the front of the classroom within the first 5 minutes of the class:
    cs1007-002: 11.05am
    cs1007-001: 2.45pm

This assignment is worth 7 points (out of 100 for the semester). Distribution of points is: