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(); + } + + }