Browse Source

try_catch_SaveNote

remotes/origin/server
Marc Dimmerling 11 months ago
parent
commit
d91356f9ee
  1. 7
      src/main/java/Notizbuch.java

7
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() {

Loading…
Cancel
Save