summaryrefslogtreecommitdiff
path: root/altosuilib/AltosUIFrame.java
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2016-06-17 10:00:10 -0600
committerBdale Garbee <bdale@gag.com>2016-06-17 10:00:10 -0600
commit31cf047113ec72a78f4b500223a2c6be23bc86fd (patch)
tree4f171ddf642fb06bd1b520cd98a242efe5f8320f /altosuilib/AltosUIFrame.java
parent2f0c977c747824d0798550ac64eceb1d66c50efd (diff)
parentafe74c067a31ce420d0d4cdac2069c1d258a5114 (diff)
Merge branch 'master' into branch-1.6
Diffstat (limited to 'altosuilib/AltosUIFrame.java')
-rw-r--r--altosuilib/AltosUIFrame.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java
index 295225d6..ac440190 100644
--- a/altosuilib/AltosUIFrame.java
+++ b/altosuilib/AltosUIFrame.java
@@ -15,7 +15,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_10;
+package org.altusmetrum.altosuilib_11;
import java.awt.*;
import java.awt.event.*;
@@ -23,8 +23,13 @@ import javax.swing.*;
import java.util.*;
class AltosUIFrameListener extends WindowAdapter {
+ @Override
public void windowClosing (WindowEvent e) {
- AltosUIPreferences.unregister_ui_listener((AltosUIFrame) e.getWindow());
+ AltosUIFrame frame = (AltosUIFrame) e.getWindow();
+ AltosUIPreferences.unregister_ui_listener(frame);
+ AltosUIFrame.frame_closed();
+ frame.setVisible(false);
+ frame.dispose();
}
}
@@ -263,10 +268,23 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi
return constraints(x, width, GridBagConstraints.NONE);
}
+ static int open_frames;
+
+ public static void frame_opened() {
+ ++open_frames;
+ }
+
+ public static void frame_closed() {
+ --open_frames;
+ if (open_frames == 0)
+ System.exit(0);
+ }
+
void init() {
AltosUIPreferences.register_ui_listener(this);
AltosUIPreferences.register_position_listener(this);
position = AltosUIPreferences.position();
+ frame_opened();
addWindowListener(new AltosUIFrameListener());
/* Try to make menus live in the menu bar like regular Mac apps */