In this lab, you are given a program that can display a single image, and you have to modify it so that it can display a list of images. The images are little "icons" that can be placed in a display area by the user. Since the number of images varies as the program runs, you need to use the technique of "partially full arrays."
Since last week's lab turned out to be too long, only Part 1 of that lab is due today; Parts 2 and 3 are due next Tuesday, along with the lab for this week. You should be able to complete the partially-full array exercise before the end of the lab period today. You can use any remaining time to work on Parts 2 and 3 of Labs 11 (or, if you have completed Lab 11 already, you could work on your final project).
As usual, you can begin the lab by creating a new Java project in Eclipse. Into that project, you should import the entire contents of the directory /classes/f05/cs124/lab12. This will include three files, FileIO.java, IconStampPad.java, SillyStamperApplication.java, and a directory named icons that holds all the icon images that will be used in the program. Be sure that you select the icon directory, and not just the individual files in the icon directory; after you finish the import, the icon images should still be in a directory named icons inside Eclipse. (In case you want to download the files for this lab off the Web, the icons directory is also available in a zip file, icons.zip, to make them easier to download.)
After doing the import, you can run SillyStamperApplication as an application. You should see a large display area with a list of icons to the right and a few control buttons at the bottom of the window. You can select an icon in the list by clicking on it. If you click the display area, a copy of the currently selected icon will be shown in the display area at the point where you click. As the program is currently written, only one icon at a time can be displayed. Your job is to make it possible to display a list of icons. You will be working only in the file IconStampPad.java. The six parts of the program that you have to modify are each marked with a "TODO". The six modifications are:
Exercise: Modify the file IconStampPad.java, as described above, to use arrays to store data about the icons in the picture. Use your modified program to load the sample data file /classes/f05/cs124/SillyStamperExample.data, and show me the resulting picture on your computer screen. (Also, as usual, turn in a printout of the modified file next week, along with a printout of your VideoPokerPanel.java file from Lab 11.)
If you would like some extra credit on this lab, add a "Redo" button to the applet. This button should "undo the most recent undo", if any. To make this work, you need to keep track of how many redo's are available. This number goes up when an Undo is performed. It goes down when a Redo is performed, and it is reset to zero whenever a new icon image is added to the picture. Ideally, you should enable/disable the Undo and Redo buttons, so that they are only enabled when there is something for them to do. You might also want to add a "Clear" button.