Computer Science 122
Assignment 7
Due: November 11, 2003

For this assignment, you should write a program with two frames.  The first one is used to display the data in your file.  In addition it should have a button that opens a second frame.  This one should have a TextField and a TextArea.  Use the TextField to get a product ID.  Then use that ID to find a product in the list.  If you find it, display the product in the TextArea.  If you don’t, display an error message.  You should also have a Button that will return the user to the first frame.

Only the first frame should have a window closer.  If you have one in the second frame, clicking it will close the entire program.  So instead, have a button that will hide (setVisible (false)) the second frame.

You should have one list class that will work for both frames.  I common source of trouble is to have duplicate copies.  Instantiate the list (get a new instance) in the first frame class.  Then send this as a parameter to the constructor of the second frame.  Do not get a new instance in the second frame.  Use the instance that it receives from the first one.

If you don’t do this, your program may work all right.  But it will not be as easy to extend it when you go to the next assignment.  In that one, we will change the list by either adding or deleting a product.  The second frame should have something like the following:

 private ListClass list;
 
 FindFrame (ListClass productList)
 {
      super ("Find a Product");
      setSize (300, 300);
 
      list = productList;

Divide your program into separate files in one package.  Hand in printouts of all the files together with a disk that has the code.