Skip to content

Commit 00a91b2

Browse files
[#577] Use native Mac menu bar
1 parent 94c18bb commit 00a91b2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/org/jetuml/gui/EditorFrame.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public EditorFrame(Stage pMainStage, Stage pDialogStage)
105105
aRecentFiles.deserialize(Preferences.userNodeForPackage(JetUML.class).get("recent", "").trim());
106106

107107
MenuBar menuBar = new MenuBar();
108+
moveMenuBarToMacNativeMenuBar(menuBar);
108109
setTop(menuBar);
109110

110111
TabPane tabPane = new TabPane();
@@ -155,6 +156,19 @@ private static String[] validFormats(String... pDesiredFormats)
155156
}
156157
return validFormats.toArray(new String[validFormats.size()]);
157158
}
159+
160+
/*
161+
* Moves the menu bar to the system menu bar on macOS systems.
162+
* A macOS system is indicated by the string "Mac OS X" in
163+
* System property `os.name`.
164+
*/
165+
private void moveMenuBarToMacNativeMenuBar(MenuBar pMenuBar)
166+
{
167+
if (System.getProperty("os.name").equals("Mac OS X"))
168+
{
169+
pMenuBar.setUseSystemMenuBar(true);
170+
}
171+
}
158172

159173
/*
160174
* Traverses all menu items up to the second level (top level

0 commit comments

Comments
 (0)