Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Menu

[22:7] extends: MenuItem

The Menu class wraps the JavaFX Menu control, a popup list of selectable items that is added to a MenuBar or nested inside another Menu as a submenu. Menu extends MenuItem, which means it inherits click-event support and optional graphic icons alongside its text label. When a user clicks a Menu entry in the bar it opens and displays its child MenuItems or nested Menus. The showing pseudo-class is applied automatically by JavaFX while the menu popup is open, allowing stylesheet rules to change appearance during that state.

CSS Pseudo-classes -- Menu

Pseudo-class Description
showing Applies while the Menu popup is open and its items are visible.

Methods

  • Menu (string Name)

    Initializes a new Menu instance with the specified name.

    • @p Name The name displayed on the menu.
    • @r this object
  • add (Items)

    Adds one or more Menu or MenuItem objects to this Menu.

    • @p Items Either a single Menu/MenuItem or a list of them to add.
    • @r this object
  • isShowing ()

    Returns whether the menu popup is currently visible.

    • @r A bool that is true when the popup is showing.
  • showingProperty ()

    Returns the read-only showing property for binding or change listeners.

    • @r An AussomJavaObject around a ReadOnlyBooleanProperty.
  • onShowingProperty ()

    Returns the onShowing property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty<EventHandler>.
  • setOnShowing (callback Cb)

    Registers a callback invoked just before the menu popup becomes visible.

    • @p Cb is a callback function invoked with the Event AJO.
    • @r this object for chaining
  • getOnShowing ()

    Returns the current onShowing EventHandler AJO.

    • @r An AussomJavaObject around the EventHandler, or null.
  • onShownProperty ()

    Returns the onShown property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty<EventHandler>.
  • setOnShown (callback Cb)

    Registers a callback invoked when the menu popup is shown.

    • @p Cb is a callback function invoked with the Event AJO.
    • @r this object for chaining
  • getOnShown ()

    Returns the current onShown EventHandler AJO.

    • @r An AussomJavaObject around the EventHandler, or null.
  • onHidingProperty ()

    Returns the onHiding property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty<EventHandler>.
  • setOnHiding (callback Cb)

    Registers a callback invoked just before the menu popup hides.

    • @p Cb is a callback function invoked with the Event AJO.
    • @r this object for chaining
  • getOnHiding ()

    Returns the current onHiding EventHandler AJO.

    • @r An AussomJavaObject around the EventHandler, or null.
  • onHiddenProperty ()

    Returns the onHidden property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty<EventHandler>.
  • setOnHidden (callback Cb)

    Registers a callback invoked when the menu popup has been hidden.

    • @p Cb is a callback function invoked with the Event AJO.
    • @r this object for chaining
  • getOnHidden ()

    Returns the current onHidden EventHandler AJO.

    • @r An AussomJavaObject around the EventHandler, or null.
  • getItems ()

    Returns the observable list of child MenuItems contained in this menu.

    • @r An AussomJavaObject around an ObservableList.
  • show ()

    Shows the menu popup.

    • @r this object for chaining
  • hide ()

    Hides the menu popup.

    • @r this object for chaining