RFR: 8366568: Allow replacing built in application menu in system menu bar
Martin Fox
mfox at openjdk.org
Tue Sep 2 15:31:06 UTC 2025
This PR provides an API for replacing the application menu that JavaFX places in the system menu bar on macOS. The application menu is the one next to the Apple menu that is titled with the application's name and contains the Quit menu item. The JavaFX version of this menu has many limitations so this PR allows a developer to simply replace it outright.
Technically there’s no reason to restrict this to only one menu so the API allows the developer to specify an observable list of Menus known as the common system menus. Like the current application menu the common menus are present for all JavaFX windows and remain present even if all windows lose focus. Any per-window menus provided by a MenuBar with useSystemMenuBar set will appear alongside the common system menus.
In addition the PR provides some calls that allow a developer to implement the Hide <app name>, Hide Others, and Show All menu items that are expected in the application menu.
-------------
Commit messages:
- Merge remote-tracking branch 'upstream/master' into commonmenus
- Specify a list of menus that are always present in the system menu bar
Changes: https://git.openjdk.org/jfx/pull/1881/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1881&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8366568
Stats: 586 lines in 12 files changed: 560 ins; 21 del; 5 mod
Patch: https://git.openjdk.org/jfx/pull/1881.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1881/head:pull/1881
PR: https://git.openjdk.org/jfx/pull/1881
More information about the openjfx-dev
mailing list