-This is my code:
private void loadList() {
try {
List tasks = (List) Reader.readTasks(new File(SAVE_DESTINATION));
String firstTask = tasks.getItem(0);
listModel.addElement(firstTask);
} catch (IOException | ClassNotFoundException e) {
System.out.println("Unable to load tasks from " + SAVE_DESTINATION);
e.printStackTrace();
}
}
-I am getting this error:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.awt.List
(My saved list will be longer than 1 item long, above I was trying to see if I could at least get the first element in the list to load up.)
I have already got save working so I can save a to do list. I want to be able to load the saved to do list when the program starts. Can anyone help??