On Wed, 1 Jul 2026 19:44:43 GMT, Martin Fox <[email protected]> wrote:
>> 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. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Martin Fox has updated the pull request with a new target base due to a merge > or a rebase. The incremental webrev excludes the unrelated changes brought in > by the merge/rebase. The pull request contains eight additional commits since > the last revision: > > - Merge remote-tracking branch 'upstream/master' into commonmenus > - Tweaked testing utility that searches NSApp.mainMenu, added tests > - Merge remote-tracking branch 'upstream/master' into commonmenus > - New way of testing system menu bar, updated tests > - Merge remote-tracking branch 'upstream/master' into commonmenus > - Quick fix for a javadoc issue. > - Merge remote-tracking branch 'upstream/master' into commonmenus > - Specify a list of menus that are always present in the system menu bar A few questions: 1. what is the status of the other JBS tickets in relation to this PR? Are any of these getting fixed by this change? 2. what about swing/fx interop? do we need more tests developed, or testing done? 3. is there any way to insert the standard platform menu such as Help (one with the search box)? 4. some added public APIs added seem unnecessary, what was the reason for their inclusion? 5. (probably unrelated) the first system menu is "java" - is there a way to customize that? Also, it would be *awfully* nice to have a small demo app to showcase the feature and the related issues, possibly with a swing frames as well. I tried to cannibalize the test code in https://github.com/andy-goryachev-oracle/Test/blob/8366568.system.menu/src/goryachev/tests/SystemMenu_8366568.java but it is somewhat lacking. modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuBarSkin.java line 511: > 509: * @param menuList list of common menus > 510: */ > 511: public static void setCommonSystemMenus(final ObservableList<Menu> > menuList) { This adds a public API (the skin is public). Do we *want* to have this as public API? If not, we should probably use a helper. modules/javafx.graphics/src/main/java/javafx/application/ApplicationServices.java line 32: > 30: /** > 31: * This class provides services for an Application. This includes > 32: * methods to show and hide other applications. what is the purpose of this? how is it relevant to the application menu? tests/system/src/test/java/test/javafx/scene/control/CommonSystemMenusTest.java line 51: > 49: import test.util.Util; > 50: > 51: public class CommonSystemMenusTest { Does this PR impact swing/fx interop? If yes, shouldn't we have more tests that verify that the system menus are correctly handled between swing and fx? ------------- PR Review: https://git.openjdk.org/jfx/pull/1881#pullrequestreview-4612237403 PR Review Comment: https://git.openjdk.org/jfx/pull/1881#discussion_r3508753588 PR Review Comment: https://git.openjdk.org/jfx/pull/1881#discussion_r3508783037 PR Review Comment: https://git.openjdk.org/jfx/pull/1881#discussion_r3508791299
