Class MenuPopupView

  • All Implemented Interfaces:
    Styleable, EventTarget

    public class MenuPopupView
    extends PopupView

    The MenuPopupView class is used to show JavaFX Menu instances within the user interface - it will appear relative to the given owner node.


    The following example shows a MenuPopupView when the user presses the button with the label "Click".

     public class MyApp extends MobileApplication {
       private Button buttonMenu;
       public void init() {
         addViewFactory(HOME_VIEW, () -> {
           buttonMenu = new Button("Click");
           buttonMenu.setOnAction(e -> showLayer("New Layer"));
           return new View(buttonMenu) {
             protected void updateAppBar(AppBar appBar) {
         addLayerFactory("New Layer", () -> {
           Menu menu = new Menu();
           menu.getItems().addAll(new CheckMenuItem("Check Item 1"), new RadioMenuItem("Radio Item 1"), new MenuItem("Item 3"));
           return new MenuPopupView(buttonMenu, menu);

    Screenshot of MenuPopupView

    • Constructor Detail

      • MenuPopupView

        public MenuPopupView​(Node ownerNode,
                             Menu menu)
        Creates a new MenuPopupView instance that will be displayed relative to the given ownerNode, and will contain the given Menu.
        ownerNode - The node that the popup menu should be shown relative to.
        menu - The menu to show.