API REVIEW request for RT-19857 Keeping menu in the Mac menu bar when there is no more stage
leif.samuelsson at oracle.com
Fri Apr 27 14:56:46 PDT 2012
Two new static methods in javafx.scene.control.MenuBar:
* Use the system menu bar if the current platform supports it.
* Associates menuBar with stage, so that the menus are shown in the
* system menu bar when the stage is focused.
* If stage is null, then menuBar will be used as the default for when there is
* no stage focused, or when the currently focused Stage has no associated MenuBar
* and is not owned by a Stage that has an associated MenuBar.
* If menuBar is null, then stage (or default if stage is also null) will
* no longer be explicitly associated with a MenuBar.
public static void setSystemMenuBar(Stage stage, MenuBar menuBar);
* Returns the MenuBar associated with stage, the default MenuBar if stage is
* null, or null if no MenuBar has been associated with stage.
public static MenuBar getSystemMenuBar(Stage stage);
These methods supersede the property useSystemMenuBar, which may be deprecated
at some point from the public API.
The main difference is that the property useSystemMenuBar requires that the
MenuBar is added to a scene graph in order for it to be associated with a Stage,
but the new method setSystemMenuBar() does not require this. The new method also
allows a MenuBar instance to be shared between multiple Stage instances as long
as it is not also added to a Scene.
The initial implementation will link setSystemMenuBar() to affect the property
and vice versa, so it is advised to only use one or the other in application
A MenuBar that is not added to a Scene will not get property values from CSS.
This means that menus and items can not have icon images defined in a stylesheet
or with setStyle().
More information about the openjfx-dev