Java Input/Output  «Prev   Next»

Lesson 6

Save Restore Draw Applet Project

In this module, you will complete another version of the drawing applet. We will provide you some code to get you started. When this version runs locally on your machine, you will be able to save and restore the drawing you are working on.
Users will be able to start the applet, draw circles and squares to their heart's content, save the drawing to a file named shapes by clicking a Save button, and then restore those shapes by clicking a button named Restore.
We cannot show you this applet in action, because of the restrictions of writing to the file system using an applet downloaded from the Web. However, you will not face these security restrictions when you run locally.

Exercise: Modify the draw program to read and write

Start by creating a new file named Draw.java. Then, copy and paste this source code into your new file.

The code will not yet compile. That is what you are going to fix in this exercise, by completing those sections written in bold.
Reading Writing Java - Exercise