Saving and testing the completed To-Do List program
Now that you have completed the enhanced To-Do List program, you are ready to save and
test it.
To save and test your completed To-Do List program:
- Select Save Bean from the Bean menu to save your changes. VisualAge for
Java generates the code to implement all the work you have done in the Visual Composition
Editor since the last time you saved.
- Select Run from the tool bar.
- Try creating and saving a new To-Do file:
- Add the following items to the To-Do List. For each item, enter the item in the To-Do
Item field and select Add:
- Get paint
- Get wallpaper
- Spouse says OK?
- Start painting
- Start wallpapering
- Select Save To-Do File. A save file dialog should appear. In this dialog, go to
the directory in which you saved the test1.txt file for testing the Open To-Do File button. Enter the file name test2.txt
and select Save.
- Now try loading the list from test1.txt. Select Open To-Do File. An
open file dialog should appear. Select test1.txt, then select Open.
The original list from test1.txt should be loaded into To-Do List.
- Now try replacing the current list with the one you saved in test2.txt.
Select Open To-Do File. Select test2.txt, then select Open. The
list from test2.txt should replace the test1.txt list in To-Do
List.
Congratulations! You have completed a Java program that combines a user interface
created in the Visual Composition Editor with nonvisual code that you created directly.
Before you continue, create a versioned edition of the ToDoList class.
- Select the ToDoList class in the Workbench. Select Manage and then Version
from the Selected menu. The Versioning Selected Items SmartGuide appears.
- Ensure that Automatic is selected and select Finish.
