diff --git a/src/main/java/Notizbuch.java b/src/main/java/Notizbuch.java index 1c1bd38..83510ee 100644 --- a/src/main/java/Notizbuch.java +++ b/src/main/java/Notizbuch.java @@ -50,7 +50,12 @@ public class Notizbuch extends JFrame implements ActionListener { } private void saveNote() { - + try (PrintWriter writer = new PrintWriter(new FileWriter("notizen.txt"))) { + writer.print(textArea.getText()); + JOptionPane.showMessageDialog(this, "Notiz erfolgreich gespeichert!"); + } catch (IOException e) { + JOptionPane.showMessageDialog(this, "Fehler beim Speichern der Notiz: " + e.getMessage()); + } } private void loadNote() {