WaitingDialog: do not allow close and dispose when needed
authorNiki Roo <niki@nikiroo.be>
Mon, 4 May 2020 17:20:05 +0000 (19:20 +0200)
committerNiki Roo <niki@nikiroo.be>
Mon, 4 May 2020 17:20:05 +0000 (19:20 +0200)
ui/WaitingDialog.java

index 15dca6cce1655352e72ebba268086c6c239cdcca..7df5a8b526314917e5ef7211715f33a13ffe9f9b 100644 (file)
@@ -93,6 +93,8 @@ public class WaitingDialog extends JDialog {
                        String waitingText) {
                super(parent);
 
+               this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+
                this.pg = pg;
 
                if (waitingText != null) {
@@ -154,11 +156,14 @@ public class WaitingDialog extends JDialog {
        /**
         * Notify this {@link WaitingDialog} that the job is done, and dismiss it if
         * it was already showing on screen (or never show it if it was not).
+        * <p>
+        * Will also dispose the {@link WaitingDialog}.
         */
        public void dismiss() {
                synchronized (waitLock) {
                        if (waitScreen) {
                                setVisible(false);
+                               dispose();
                        }
                        waitScreen = true;
                }