Agenda load/save fix
This commit is contained in:
+31
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user