From dd7893375e3d7a864efacb95901ffcb1726bc5a6 Mon Sep 17 00:00:00 2001 From: guusvdongen Date: Thu, 12 Mar 2015 18:12:25 +0100 Subject: [PATCH] Agenda load/save fix --- Agenda fix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Agenda fix diff --git a/Agenda fix b/Agenda fix new file mode 100644 index 0000000..c01355d --- /dev/null +++ b/Agenda fix @@ -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(); + } + + }