Homework Assignment 8

Adding a GUI Front End to AssociationLists

Computer Science II
Object-Oriented Programming

Due: Friday, April 8, at 4:00 PM


Back in Homeworks 3 and 4, you wrote AssociationList, which defines a class of a simple key/value databases. We can add entries to an AssociationList, remove and update entries, and retrieves by key and full-text search. We can also clear the list, read associations from a file, and save them to a file.

Now that we have begun to learn how to implement graphical interfaces in Java, we can take the next natural step and design a graphical note-taking program. We will call our program a Notebook.

Programming Advice

Use your solution to Homework 4 as the code for your AssociationList. Use the ideas you've studied in Sessions 15 through 22 to implement your GUI interface.

As always, write your program in the style we have been using all semester. Take small steps. We can't write tests very easily for graphical programs, but we can choose to implement our program in small steps. Before you write a new bit of code, you should know just what you would like that code to do, and how you will be able to tell if your code does it. Only then should you write the code. Refactor your code after each step, to ensure that your program is as easy to extend with the next functionality as possible.


Write the following three files:

  1. Notebook.java

    Notebook consists only of a main() method. This method creates an AssociationList, creates a NotebookFrame, and displays the frame on the screen.

    Notebook takes one optional command-line argument, the name of a file of Associations. If the user does not give a command-line argument, then the AssociationList starts empty. If the user does give a command-line argument, then the corresponding file of associations is loaded into the AssociationList.

    (Remember: AssociationLists know how to load Associations from a file!)

  2. NotebookFrame.java

    A NotebookFrame is a window with at least these components:

    You should have buttons for sending the following messages to the AssociationList:

    Some further instructions:

    You may lay out your frame it in whatever way you wish. Feel free to add graphical flourishes to your interface -- so long as you have the required functionality done first!

  3. readme.txt

    This text file explains the design of your program and lists all of its Java files, in the order they appear in your print-out


By the due date and time, submit the files

Be sure that your submission follows all homework submission requirements.

Eugene Wallingford ..... wallingf@cs.uni.edu .... March 30, 2005