Skip to content

Commit fe1838d

Browse files
[#577] Use native Mac menu bar
1 parent 9cef371 commit fe1838d

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
@@ -103,6 +103,7 @@ public EditorFrame(Stage pMainStage, Stage pDialogStage) {
103103
aRecentFiles.deserialize(Preferences.userNodeForPackage(JetUML.class).get("recent", "").trim());
104104

105105
MenuBar menuBar = new MenuBar();
106+
moveMenuBarToMacNativeMenuBar(menuBar);
106107
setTop(menuBar);
107108

108109
TabPane tabPane = new TabPane();
@@ -146,6 +147,19 @@ private static String[] validFormats(String... pDesiredFormats) {
146147
}
147148
return validFormats.toArray(new String[validFormats.size()]);
148149
}
150+
151+
/*
152+
* Moves the menu bar to the system menu bar on macOS systems.
153+
* A macOS system is indicated by the string "Mac OS X" in
154+
* System property `os.name`.
155+
*/
156+
private void moveMenuBarToMacNativeMenuBar(MenuBar pMenuBar)
157+
{
158+
if (System.getProperty("os.name").equals("Mac OS X"))
159+
{
160+
pMenuBar.setUseSystemMenuBar(true);
161+
}
162+
}
149163

150164
/*
151165
* Traverses all menu items up to the second level (top level

0 commit comments

Comments
 (0)