diff options
| author | Keith Packard <keithp@keithp.com> | 2014-06-16 21:58:13 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2014-06-16 21:58:13 -0700 | 
| commit | ed38b1b596062b2232fa78a3181f6eaf5818b651 (patch) | |
| tree | 4a7aaea319aac9fab826af2a6daf8e61d4955bdf | |
| parent | e612693e33ef3b0e22db0656792992fa6e961ff2 (diff) | |
altosuilib: Move menu bars into the Mac OS X top bar
Setting these properties causes the top menu bar to get placed into
the Mac OS X window system menu bar
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | altosuilib/AltosUIFrame.java | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java index 6e62c762..2de1fb1c 100644 --- a/altosuilib/AltosUIFrame.java +++ b/altosuilib/AltosUIFrame.java @@ -157,11 +157,28 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi  		}  	} +	static boolean global_settings_done; + +	public String getName() { +		return "Altus Metrum"; +	} +  	void init() {  		AltosUIPreferences.register_ui_listener(this);  		AltosUIPreferences.register_position_listener(this);  		position = AltosUIPreferences.position();  		addWindowListener(new AltosUIFrameListener()); + +		/* Try to make menus live in the menu bar like regular Mac apps */ +		if (!global_settings_done) { +			try { +				global_settings_done = true; +				System.setProperty("com.apple.mrj.application.apple.menu.about.name", getName()); +				System.setProperty("com.apple.macos.useScreenMenuBar", "true"); +				System.setProperty( "apple.laf.useScreenMenuBar", "true" ); // for older versions of Java +			} catch (Exception e) { +			} +		}  		set_icon();  	}  | 
