-
Bug
-
Resolution: Not an Issue
-
P4
-
17, 21, 22, 23
-
generic
-
os_x
ADDITIONAL SYSTEM INFORMATION :
macOS 14.4.1
A DESCRIPTION OF THE PROBLEM :
If this code is used, many menu item accelerators (e.g. Cmd-S) do not trigger the item's action:
if (app.isSupported(Desktop.Action.APP_MENU_BAR)) {
Desktop.getDesktop().setDefaultMenuBar(menuBar);
} else {
setJMenuBar(menuBar);
}
If this is used instead, menu item accelerators do work:
System.setProperty("apple.laf.useScreenMenuBar", "true");
setJMenuBar(menuBar);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a project with this file
2. Run it on macOS.
3. Press Cmd-Delete. Nothing is printed to the console.
4. Set `fixed = true` on line 11.
5. Run.
6. Press Cmd-Delete. "Delete pressed" is printed to the console.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The menu item's action should be triggered.
ACTUAL -
The menu item highlights, but the action is not triggered.
---------- BEGIN SOURCE ----------
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use:
System.setProperty("apple.laf.useScreenMenuBar", "true");
setJMenuBar(menuBar);
instead of:
Desktop.getDesktop().setDefaultMenuBar(menuBar);
FREQUENCY : always
macOS 14.4.1
A DESCRIPTION OF THE PROBLEM :
If this code is used, many menu item accelerators (e.g. Cmd-S) do not trigger the item's action:
if (app.isSupported(Desktop.Action.APP_MENU_BAR)) {
Desktop.getDesktop().setDefaultMenuBar(menuBar);
} else {
setJMenuBar(menuBar);
}
If this is used instead, menu item accelerators do work:
System.setProperty("apple.laf.useScreenMenuBar", "true");
setJMenuBar(menuBar);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a project with this file
2. Run it on macOS.
3. Press Cmd-Delete. Nothing is printed to the console.
4. Set `fixed = true` on line 11.
5. Run.
6. Press Cmd-Delete. "Delete pressed" is printed to the console.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The menu item's action should be triggered.
ACTUAL -
The menu item highlights, but the action is not triggered.
---------- BEGIN SOURCE ----------
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use:
System.setProperty("apple.laf.useScreenMenuBar", "true");
setJMenuBar(menuBar);
instead of:
Desktop.getDesktop().setDefaultMenuBar(menuBar);
FREQUENCY : always
- links to
-
Review(master) openjdk/jdk/19714