if (e.getActionCommand().equals(ActionCommands.SAVE)) { try { FileOutputStream fos = new FileOutputStream"C:\\Graph.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(listData); oos.close(); JOptionPane.showMessageDialog(this, "Datei gespeichert in C:\\Graph.txt"); } catch (Exception exc){ JOptionPane.showMessageDialog(this,"Fehler beim Speichern der Datei!"); } return;}
if (e.getActionCommand().equals(ActionCommands.OPEN)) { try { FileInputStream fis = new FileInputStream("C:\\Graph.txt"); ObjectInputStream ois = new ObjectInputStream(fis); ArrayList listData = (ArrayList)ois.readObject(); ois.close(); JOptionPane.showMessageDialog(this, "Datei geladen: C:\\Graph.txt!"); } } catch (Exception exc){ JOptionPane.showMessageDialog(this, "Keine Datei zum Laden vorhanden!"); } return;}