Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: MenuItem

[18:7] extends: FxObj

Wraps JavaFX MenuItem, a single selectable item in a Menu or ContextMenu that triggers an action when chosen. Each item displays a text label and optionally an image graphic. Register a click handler with onClick() to respond when the user selects the item. MenuItem is the base type for more specialized items such as CheckMenuItem and RadioMenuItem. MenuItem is not a Node — it inherits directly from Object and implements EventTarget and Styleable. It is consumed by Menu and ContextMenu rather than being placed in the scene graph itself.

Methods

  • MenuItem (string Name, Img = null)

    Initializes a new MenuItem with the specified name and optional image.

    • @p Name The name displayed on the menu item.
    • @p Img An optional Image wrapper to display alongside the menu item.
    • @r this object
  • adopt (object Ajo)

    Wraps an existing javafx.scene.control.MenuItem AussomJavaObject in a MenuItem wrapper without invoking the standard constructor.

    • @p Ajo is the AussomJavaObject around a javafx.scene.control.MenuItem instance.
    • @r A new MenuItem wrapper around the provided object.
  • onClick (callback OnClick)

    Sets a callback function to execute when the menu item is clicked.

    • @p OnClick The callback function for the click event.
    • @r this object
  • setId (string Id)

    Sets the CSS id used to select this menu item in a stylesheet.

    • @p Id is the id string, or null to clear.
    • @r this object
  • getId ()

    Returns the CSS id assigned to this menu item.

    • @r A string with the id, or null when unset.
  • idProperty ()

    Returns the id property for binding or change listeners.

    • @r An AussomJavaObject around a StringProperty.
  • setStyle (string Style)

    Sets the inline CSS style applied to this menu item.

    • @p Style is a CSS declaration string, or null to clear.
    • @r this object
  • getStyle ()

    Returns the inline CSS style applied to this menu item.

    • @r A string with the inline style, or null when unset.
  • styleProperty ()

    Returns the style property for binding or change listeners.

    • @r An AussomJavaObject around a StringProperty.
  • getParentMenu ()

    Returns the Menu that owns this item, or null when the item is detached or owned by a ContextMenu.

    • @r An AussomJavaObject around the parent javafx.scene.control.Menu, or null.
  • parentMenuProperty ()

    Returns the read-only parentMenu property for change listeners.

    • @r An AussomJavaObject around a ReadOnlyObjectProperty.
  • getParentPopup ()

    Returns the ContextMenu that owns this item, or null when the item is owned by a Menu or is detached.

    • @r An AussomJavaObject around the parent javafx.scene.control.ContextMenu, or null.
  • parentPopupProperty ()

    Returns the read-only parentPopup property for change listeners.

    • @r An AussomJavaObject around a ReadOnlyObjectProperty.
  • setText (string Text)

    Sets the text displayed by the menu item.

    • @p Text is the menu item label, or null to clear.
    • @r this object
  • getText ()

    Returns the text currently displayed by the menu item.

    • @r A string with the label, or null when unset.
  • textProperty ()

    Returns the text property for binding or change listeners.

    • @r An AussomJavaObject around a StringProperty.
  • setGraphic (object Graphic)

    Sets the graphic Node displayed alongside the menu item text.

    • @p Graphic is an Aussom wrapper whose .obj holds the javafx.scene.Node.
    • @r this object
  • getGraphic ()

    Returns the graphic Node currently shown alongside the menu item text.

    • @r An AussomJavaObject around the Node, or null when unset.
  • graphicProperty ()

    Returns the graphic property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty.
  • setOnAction (object Handler)

    Sets the EventHandler invoked when the menu item is selected. Most callers should use onClick(callback) to register an Aussom callback.

    • @p Handler is an AussomJavaObject around a javafx.event.EventHandler.
    • @r this object
  • getOnAction ()

    Returns the EventHandler currently registered for the action event.

    • @r An AussomJavaObject around the javafx.event.EventHandler, or null when unset.
  • onActionProperty ()

    Returns the onAction property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty<EventHandler>.
  • setOnMenuValidation (object Handler)

    Sets the EventHandler invoked when the menu item receives the MENU_VALIDATION_EVENT.

    • @p Handler is an AussomJavaObject around a javafx.event.EventHandler.
    • @r this object
  • getOnMenuValidation ()

    Returns the EventHandler currently registered for menu validation.

    • @r An AussomJavaObject around the javafx.event.EventHandler, or null when unset.
  • onMenuValidationProperty ()

    Returns the onMenuValidation property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty<EventHandler>.
  • setDisable (bool Disable)

    Sets whether the menu item is disabled. Disabled items are rendered grayed out and do not respond to user input.

    • @p Disable is a bool; true disables the item.
    • @r this object
  • isDisable ()

    Returns whether the menu item is currently disabled.

    • @r A bool that is true when the item is disabled.
  • disableProperty ()

    Returns the disable property for binding or change listeners.

    • @r An AussomJavaObject around a BooleanProperty.
  • setVisible (bool Visible)

    Sets whether the menu item is visible in its parent menu.

    • @p Visible is a bool; true shows the item, false hides it.
    • @r this object
  • isVisible ()

    Returns whether the menu item is currently visible.

    • @r A bool that is true when the item is visible.
  • visibleProperty ()

    Returns the visible property for binding or change listeners.

    • @r An AussomJavaObject around a BooleanProperty.
  • setAccelerator (object Accelerator)

    Sets the keyboard accelerator that fires this menu item.

    • @p Accelerator is an AussomJavaObject around a javafx.scene.input.KeyCombination.
    • @r this object
  • getAccelerator ()

    Returns the keyboard accelerator currently bound to the menu item.

    • @r An AussomJavaObject around the KeyCombination, or null when unset.
  • acceleratorProperty ()

    Returns the accelerator property for binding or change listeners.

    • @r An AussomJavaObject around an ObjectProperty.
  • setMnemonicParsing (bool MnemonicParsing)

    Sets whether mnemonic parsing is enabled. When true an underscore in the text marks the next character as a mnemonic accelerator.

    • @p MnemonicParsing is a bool; true enables parsing.
    • @r this object
  • isMnemonicParsing ()

    Returns whether mnemonic parsing is currently enabled.

    • @r A bool that is true when mnemonic parsing is active.
  • mnemonicParsingProperty ()

    Returns the mnemonicParsing property for binding or change listeners.

    • @r An AussomJavaObject around a BooleanProperty.
  • getStyleClass ()

    Returns the observable list of CSS style class names applied to this menu item.

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

    Fires the menu item programmatically as if the user had selected it.

    • @r this object
  • buildEventDispatchChain (object Tail)

    Appends this menu item's event handler manager to the given dispatch chain so events routed to the item are processed correctly.

    • @p Tail is an AussomJavaObject around the existing EventDispatchChain.
    • @r An AussomJavaObject around the extended EventDispatchChain.
  • addEventHandler (object EventType, object Handler)

    Registers an event handler for the given event type.

    • @p EventType is an AussomJavaObject around a javafx.event.EventType value.
    • @p Handler is an AussomJavaObject around a javafx.event.EventHandler.
    • @r this object
  • removeEventHandler (object EventType, object Handler)

    Removes a previously registered event handler for the given event type.

    • @p EventType is an AussomJavaObject around a javafx.event.EventType value.
    • @p Handler is an AussomJavaObject around the javafx.event.EventHandler to remove.
    • @r this object
  • addEventFilter (object EventType, object Handler)

    Registers an event filter for the given event type. Filters run before handlers and can consume the event.

    • @p EventType is an AussomJavaObject around a javafx.event.EventType value.
    • @p Handler is an AussomJavaObject around the javafx.event.EventHandler.
    • @r this object
  • removeEventFilter (object EventType, object Handler)

    Removes a previously registered event filter for the given event type.

    • @p EventType is an AussomJavaObject around a javafx.event.EventType value.
    • @p Handler is an AussomJavaObject around the javafx.event.EventHandler to remove.
    • @r this object
  • getUserData ()

    Returns the user data object previously attached to this menu item.

    • @r An AussomJavaObject around the user data value, or null.
  • setUserData (UserData)

    Attaches an arbitrary value to this menu item for application use.

    • @p UserData is the value to store, or null to clear.
    • @r this object
  • getProperties ()

    Returns the observable property map associated with this menu item. The map is created on first access.

    • @r An AussomJavaObject around an ObservableMap<Object,Object>.
  • getTypeSelector ()

    Returns the CSS type selector used by the JavaFX CSS engine for this menu item (typically "MenuItem").

    • @r A string with the type selector.
  • getStyleableParent ()

    Returns the Styleable parent used by the CSS engine when resolving inherited properties.

    • @r An AussomJavaObject around the parent Styleable, or null when none.
  • getPseudoClassStates ()

    Returns the observable set of pseudo-class states currently active on this menu item.

    • @r An AussomJavaObject around an ObservableSet.
  • getCssMetaData ()

    Returns the CSS metadata describing the styleable properties supported by this menu item.

    • @r An AussomJavaObject around a List of CssMetaData entries.
  • getStyleableNode ()

    Returns the Node used by the CSS engine to apply styles to this menu item, or null when no rendered node exists yet.

    • @r An AussomJavaObject around the javafx.scene.Node, or null.