Adding buttons to the To-Do List applet user interface
You have completed all of the steps that added logic to the ToDoList class. Now you are
ready to make modifications to the user interface of the To-Do List applet. Your current
To-Do List applet should look like this:

You need to add two new buttons to this user interface:
- An Open To-Do File button to trigger opening a file to read into the To-Do list
- A Save To-Do File button to trigger saving the contents of the To-Do list to a
file
To add these two buttons:
- Select the ToDoList class for your To-Do List applet.
- From the Selected menu, select Open To and then Visual Composition.
- The free-form surface appears. It should look like this:

- Select a JButton bean and add a button under the existing Remove button.
You may need to move your Add and Remove buttons or lengthen the free-form
surface to make space for your new button.
- Select the button you just added and change its text to Open To-Do File.... To
change the text:
- Open Properties for the new JButton (JButton3).
- Change the text value to Open To-Do File....
- Follow the same procedure to add another button below JButton3. Change the text of this
button to Save To-Do File...
- Size the new buttons to match the width of the existing buttons:
- Select the Add button. Hold down the Ctrl key and select the Remove, Open
To-Do File and Save To-Do File buttons so that all four buttons are selected.
The Save To-Do File button, the last bean selected, has solid selection handles,
indicating that it is the anchor bean. The anchor bean is the bean that acts as the
guide for resizing or the bean that the other selected beans match.
- Select Match Width from the tool bar.

- Align the two new buttons with the existing Add and Remove buttons:
- Select the Save To-Do File button. Hold down the Ctrl key and select the Open
To-Do File, Remove, and Add buttons so that all four buttons are
selected. The Add button becomes the anchor bean.
- Select Align Left from the tool bar.

- Distribute evenly all four buttons:
- Because you have all buttons already selected, click Distribute Vertically on the
tool bar.

You have added the two new buttons for the To-Do List program. Now you are ready to
associate them with some action.
