diff options
| author | Bdale Garbee <bdale@gag.com> | 2016-06-17 10:02:00 -0600 |
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2016-06-17 10:02:00 -0600 |
| commit | 085336c45ce0577031a7af5de117a8b856160708 (patch) | |
| tree | 13a145eab69e38f2658359fa8395e7257b3c3fb9 /altosuilib/AltosUIFrame.java | |
| parent | 50c9a54ac6b04458970eedfa6d3e0e25f41c765f (diff) | |
| parent | 639e461ded29a48c155afea12171cbfc191ccfd7 (diff) | |
Merge branch 'branch-1.6' into debian
Diffstat (limited to 'altosuilib/AltosUIFrame.java')
| -rw-r--r-- | altosuilib/AltosUIFrame.java | 22 |
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 */ |
