The goal of this lab is to practice file I/O and to review designing windows.
In this lab we will revisit the Skeet example from lab 15. This time we will give the program the facility to save the current state of the simulation and reload it later.
The program should work as before but with two changes:
Follow these set-up instructions carefully.
Make a directory for this lab. First, copy files from the course directory for this lab:
cp /homes/tvandrun/Public/cs235/lab17/* .
Then copy from your lab15 directory
AddListener.java
and any other class that
you wrote (you should have written another action listener,
perhaps named something like OkListener.java
.
Presumably you did not modify Skeet.java
or Skeets.java
.
If you did, talk to the instructor about how to make your old
version conform to this lab.
First, discuss with your partner how you can save/store a collection of Skeets. You'll need to decided on a file format/protocol.
SaveListener
Next, finish the SaveListener
class
so that its actionPerformed()
method
puts up a window asking for a filename.
This window should also have a button labelled "Ok" or
the equivalent.
Then write another action listener class which will close that window and do the actual saving.
Finally, in the file Skeets.java
, find the
portion of code that will load a configuration from a file
and fill-in what's missing.
Email the files you wrote or modified to
Thomas.VanDrunen@wheaton.edu
.