Skip to content

Commit 10dfac4

Browse files
committed
A more robust "universal" Main on mac
1 parent b8eba8f commit 10dfac4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacUIInitializer.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
9191
@Override
9292
public void setupMenus(Application app, JFrame frame) {
9393

94+
// set additional look and feel for the window
95+
frame.getRootPane().putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);
96+
97+
// Only relocate About/Preferences/Quit to the macOS application menu when the
98+
// screen menu bar is actually in use. Otherwise the JMenuBar stays inside the
99+
// window frame, and stripping these items would make them inaccessible.
100+
if (!Boolean.getBoolean("apple.laf.useScreenMenuBar")) {
101+
return;
102+
}
103+
94104
GlobalActions globalActions = app.getActionManager();
95105

96106
Desktop desktop = Desktop.getDesktop();
@@ -104,9 +114,6 @@ public void setupMenus(Application app, JFrame frame) {
104114
}
105115
});
106116

107-
// set additional look and feel for the window
108-
frame.getRootPane().putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);
109-
110117
Set<Action> removeActions = new HashSet<>();
111118
removeActions.add(globalActions.getAction(ExitAction.class));
112119
removeActions.add(globalActions.getAction(AboutAction.class));

0 commit comments

Comments
 (0)