The next step in enhancing the To-Do List program is adding some methods that contain the logic for the To-Do List program to read and write To-Do files.
Here are the individual tasks that need to be completed to create the new class:
The following sections describe these tasks in more detail.
Importing classes required by the new methods
The new methods require two classes to be imported: com.sun.java.swing.* and java.io.* To import these additional classes:
import com.sun.java.swing.*; import java.io.*;
Adding a static variable required by the new methods
The new methods require a static variable to hold the name of the file in which the to-do list will be saved. Add this variable as follows:
static String FILE_NAME = "todo.lst";
Save your changes. Click mouse button 2 in the Source pane. Click Save.
![]() |
![]() |