From 1ea5ab0c9a62aa98351c4cccdb547e65019e7863 Mon Sep 17 00:00:00 2001 From: Ben Butzow Date: Tue, 14 Feb 2017 01:03:24 -0600 Subject: [PATCH] Add save confirmation --- src/me/butzow/pixelbreak/ImageForm.form | 8 ++++++++ src/me/butzow/pixelbreak/ImageForm.java | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/me/butzow/pixelbreak/ImageForm.form b/src/me/butzow/pixelbreak/ImageForm.form index a270ef4..8a536bf 100644 --- a/src/me/butzow/pixelbreak/ImageForm.form +++ b/src/me/butzow/pixelbreak/ImageForm.form @@ -68,6 +68,14 @@ + + + + + + + + diff --git a/src/me/butzow/pixelbreak/ImageForm.java b/src/me/butzow/pixelbreak/ImageForm.java index b795e8d..60bd0d5 100644 --- a/src/me/butzow/pixelbreak/ImageForm.java +++ b/src/me/butzow/pixelbreak/ImageForm.java @@ -23,6 +23,7 @@ public class ImageForm implements ActionListener, ChangeListener { private JSpinner spinner2; private JSpinner spinner3; private JSpinner spinner4; + private JLabel statusLabel; private Callback callback; private JFrame frame; @@ -64,8 +65,16 @@ public void saveImage(BufferedImage brokenImage) { try { File outFile = new File(outDir, selectedFilename); ImageIO.write(brokenImage, "png", outFile); - } catch (IOException e) { - e.printStackTrace(); + + statusLabel.setText("Saved!"); + Timer timer = new Timer(2000, e -> statusLabel.setText(null)); + timer.setRepeats(false); + timer.start(); + } catch (IOException ignored) { + statusLabel.setText("Error!"); + Timer timer = new Timer(2000, e -> statusLabel.setText(null)); + timer.setRepeats(false); + timer.start(); } }