From ed38b1b596062b2232fa78a3181f6eaf5818b651 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 21:58:13 -0700 Subject: [PATCH 1/1] 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 --- altosuilib/AltosUIFrame.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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(); } -- 2.30.2