COMP204-07B Assignment 3

Your task is to improve your Assignment 2 submission. Add the following buttons to your application, (or alternatively, add a menubar supplying the same funtionality):

  1. Reset Button: remove all points. This button should be disabled, when there are no points.
  2. Undo Button: remove the last added point; multiple undos will remove more and more points. When no point is left, the button should be disabled.
  3. Save Button: write all points to a text file. Use JFileChooser to select a file name. Define your format for the text file. It is ok to keep it very simple, e.g. one line per point listing x and y coordinates separated by a single space. This button should be disabled, when there are no points to save.
  4. Load Button: read in points from a text file. Again use JFileChooser to select a file name. The loaded points must be added to the current points, do not reset before loading.
  5. Quit Button: have an (annoying) modal dialog popup verifying that the user really wants to quit. Make "no" the default option.

Due date: Friday, 17th August

What to submit:

One java file containing all you code.
Document your code well.
Use the javadoc @author tag to give your name and ID!

Assessment will be slightly differently this time:

One point each for each of the five buttons specified, for a total of 5.

Here are a few hints:

  1. I'll discuss textual file IO on Thursday (August 9)
  2. A simple stack for keeping track of points should do the trick for "undoing" points.