Agenda load/save fix

This commit is contained in:
guusvdongen
2015-03-12 18:12:25 +01:00
parent 72383c9ccc
commit dd7893375e
+31
View File
@@ -0,0 +1,31 @@
public void saveAgenda(File file) {
try {
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(this);
oos.close();
JOptionPane.showMessageDialog(null, "Saved succesfully");
} catch (IOException e) {
e.printStackTrace();
}
}
public void fillAgenda(File file) {
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
Object object;
object = ois.readObject();
Agenda a = (Agenda) object;
events = a.getEvents();
stages = a.getStages();
artists = a.getArtists();
} catch (Exception e) {
e.printStackTrace();
}
}