Module javafx.controls
Package javafx.scene.control

# Class MenuItem

java.lang.Object
javafx.scene.control.MenuItem

All Implemented Interfaces:
  `Styleable`, `EventTarget`

Direct Known Subclasses:
  `CheckMenuItem`, `CustomMenuItem`, `Menu`, `RadioMenuItem`

@IDProperty("id") public class MenuItem extends Object implements EventTarget, Styleable

MenuItem is intended to be used in conjunction with `Menu` to provide options to users. MenuItem serves as the base class for the bulk of JavaFX menus API. It has a display `text` property, as well as an optional `graphic` node that can be set on it. The `accelerator` property enables accessing the associated action in one keystroke. Also, as with the `Button` control, by using the `setOnAction(javafx.event.EventHandler<javafx.event.ActionEvent>)` method, you can have an instance of MenuItem perform any action you wish.

Note: Whilst any size of graphic can be inserted into a MenuItem, the most commonly used size in most applications is 16x16 pixels. This is the recommended graphic dimension to use if you're using the default style provided by JavaFX.

To create a MenuItem is simple:

    MenuItem menuItem = new MenuItem("Open");
    menuItem.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent e) {
            System.out.println("Opening Database Connection...");
        }
    });
    menuItem.setGraphic(new ImageView(new Image("flower.png")));

Refer to the `Menu` page to learn how to insert MenuItem into a menu instance. Briefly however, you can insert the MenuItem from the previous example into a Menu as such:

    final Menu menu = new Menu("File");
    menu.getItems().add(menuItem);

Since:
  JavaFX 2.0
See Also:
  - `Menu`

## Property Summary

Properties
Type
Property
Description
`final ObjectProperty<KeyCombination>`
`accelerator`
The accelerator property enables accessing the associated action in one keystroke.
`final BooleanProperty`
`disable`
Sets the individual disabled state of this MenuItem.
`final ObjectProperty<Node>`
`graphic`
An optional graphic for the `MenuItem`.
`final StringProperty`
`id`
The id of this MenuItem.
`final BooleanProperty`
`mnemonicParsing`
MnemonicParsing property to enable/disable text parsing.
`final ObjectProperty<EventHandler<ActionEvent>>`
`onAction`
The action, which is invoked whenever the MenuItem is fired.
`final ObjectProperty<EventHandler<Event>>`
`onMenuValidation`
The event handler that is associated with invocation of an accelerator for a MenuItem.
`final ReadOnlyObjectProperty<Menu>`
`parentMenu`
This is the `Menu` in which this `MenuItem` exists.
`final ReadOnlyObjectProperty<ContextMenu>`
`parentPopup`
This is the `ContextMenu` in which this `MenuItem` exists.
`final StringProperty`
`style`
A string representation of the CSS style associated with this specific MenuItem.
`final StringProperty`
`text`
The text to display in the `MenuItem`.
`final BooleanProperty`
`visible`
Specifies whether this MenuItem should be rendered as part of the scene graph.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final EventType<Event>`
`MENU_VALIDATION_EVENT`
Called when a accelerator for the Menuitem is invoked

## Constructor Summary

Constructors
Constructor
Description
`MenuItem()`
Constructs a MenuItem with no display text.
`MenuItem(String text)`
Constructs a MenuItem and sets the display text with the specified text
`MenuItem(String text, Node graphic)`
Constructor s MenuItem and sets the display text with the specified text and sets the graphic `Node` to the given node.

## Method Summary

Modifier and Type
Method
Description
`final ObjectProperty<KeyCombination>`
`acceleratorProperty()`
The accelerator property enables accessing the associated action in one keystroke.
`<E extends Event>
void`
`addEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)`
Registers an event handler to this MenuItem.
`EventDispatchChain`
`buildEventDispatchChain(EventDispatchChain tail)`
Construct an event dispatch chain for this target.
`final BooleanProperty`
`disableProperty()`
Sets the individual disabled state of this MenuItem.
`void`
`fire()`
Fires a new ActionEvent.
`final KeyCombination`
`getAccelerator()`
Gets the value of the `accelerator` property.
`List<CssMetaData<? extends Styleable,?>>`
`getCssMetaData()`
The CssMetaData of this Styleable.
`final Node`
`getGraphic()`
Gets the value of the `graphic` property.
`final String`
`getId()`
Gets the value of the `id` property.
`final EventHandler<ActionEvent>`
`getOnAction()`
Gets the value of the `onAction` property.
`final EventHandler<Event>`
`getOnMenuValidation()`
Gets the value of the `onMenuValidation` property.
`final Menu`
`getParentMenu()`
Gets the value of the `parentMenu` property.
`final ContextMenu`
`getParentPopup()`
Gets the value of the `parentPopup` property.
`ObservableMap<Object,Object>`
`getProperties()`
Returns an observable map of properties on this menu item for use primarily by application developers.
`final ObservableSet<PseudoClass>`
`getPseudoClassStates()`
Return the pseudo-class state of this Styleable.
`final String`
`getStyle()`
Gets the value of the `style` property.
`Node`
`getStyleableNode()`
Returns the Node that represents this Styleable object.
`Styleable`
`getStyleableParent()`
Return the parent of this Styleable, or null if there is no parent.
`ObservableList<String>`
`getStyleClass()`
* Public API * *
`final String`
`getText()`
Gets the value of the `text` property.
`String`
`getTypeSelector()`
The type of this `Styleable` that is to be used in selector matching.
`Object`
`getUserData()`
Returns a previously set Object property, or null if no such property has been set using the `setUserData(java.lang.Object)` method.
`final ObjectProperty<Node>`
`graphicProperty()`
An optional graphic for the `MenuItem`.
`final StringProperty`
`idProperty()`
The id of this MenuItem.
`final boolean`
`isDisable()`
Gets the value of the `disable` property.
`final boolean`
`isMnemonicParsing()`
Gets the value of the `mnemonicParsing` property.
`final boolean`
`isVisible()`
Gets the value of the `visible` property.
`final BooleanProperty`
`mnemonicParsingProperty()`
MnemonicParsing property to enable/disable text parsing.
`final ObjectProperty<EventHandler<ActionEvent>>`
`onActionProperty()`
The action, which is invoked whenever the MenuItem is fired.
`final ObjectProperty<EventHandler<Event>>`
`onMenuValidationProperty()`
The event handler that is associated with invocation of an accelerator for a MenuItem.
`final ReadOnlyObjectProperty<Menu>`
`parentMenuProperty()`
This is the `Menu` in which this `MenuItem` exists.
`final ReadOnlyObjectProperty<ContextMenu>`
`parentPopupProperty()`
This is the `ContextMenu` in which this `MenuItem` exists.
`<E extends Event>
void`
`removeEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)`
Unregisters a previously registered event handler from this MenuItem.
`final void`
`setAccelerator(KeyCombination value)`
Sets the value of the `accelerator` property.
`final void`
`setDisable(boolean value)`
Sets the value of the `disable` property.
`final void`
`setGraphic(Node value)`
Sets the value of the `graphic` property.
`final void`
`setId(String value)`
Sets the value of the `id` property.
`final void`
`setMnemonicParsing(boolean value)`
Sets the value of the `mnemonicParsing` property.
`final void`
`setOnAction(EventHandler<ActionEvent> value)`
Sets the value of the `onAction` property.
`final void`
`setOnMenuValidation(EventHandler<Event> value)`
Sets the value of the `onMenuValidation` property.
`protected final void`
`setParentMenu(Menu value)`
Sets the value of the `parentMenu` property.
`protected final void`
`setParentPopup(ContextMenu value)`
Sets the value of the `parentPopup` property.
`final void`
`setStyle(String value)`
Sets the value of the `style` property.
`final void`
`setText(String value)`
Sets the value of the `text` property.
`void`
`setUserData(Object value)`
Convenience method for setting a single Object property that can be retrieved at a later date.
`final void`
`setVisible(boolean value)`
Sets the value of the `visible` property.
`final StringProperty`
`styleProperty()`
A string representation of the CSS style associated with this specific MenuItem.
`final StringProperty`
`textProperty()`
The text to display in the `MenuItem`.
`String`
`toString()`
`final BooleanProperty`
`visibleProperty()`
Specifies whether this MenuItem should be rendered as part of the scene graph.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Property Details

### id

public final StringProperty idProperty
The id of this MenuItem. This simple string identifier is useful for finding a specific MenuItem within the scene graph.

See Also:
  - `getId()`
  - `setId(String)`
  - `idProperty()`

### style

public final StringProperty styleProperty
A string representation of the CSS style associated with this specific MenuItem. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.

See Also:
  - `getStyle()`
  - `setStyle(String)`
  - `styleProperty()`

### parentMenu

public final ReadOnlyObjectProperty<Menu> parentMenuProperty
This is the `Menu` in which this `MenuItem` exists. It is possible for an instance of this class to not have a `parentMenu` - this means that this instance is either:

- Not yet associated with its `parentMenu`.
- A 'root' `Menu` (i.e. it is a context menu, attached directly to a `MenuBar`, `MenuButton`, or any of the other controls that use `Menu` internally.

See Also:
  - `getParentMenu()`
  - `setParentMenu(Menu)`
  - `parentMenuProperty()`

### parentPopup

public final ReadOnlyObjectProperty<ContextMenu> parentPopupProperty
This is the `ContextMenu` in which this `MenuItem` exists.

See Also:
  - `getParentPopup()`
  - `setParentPopup(ContextMenu)`
  - `parentPopupProperty()`

### text

public final StringProperty textProperty
The text to display in the `MenuItem`.

See Also:
  - `getText()`
  - `setText(String)`
  - `textProperty()`

### graphic

public final ObjectProperty<Node> graphicProperty
An optional graphic for the `MenuItem`. This will normally be an `ImageView` node, but there is no requirement for this to be the case.

See Also:
  - `getGraphic()`
  - `setGraphic(Node)`
  - `graphicProperty()`

### onAction

public final ObjectProperty<EventHandler<ActionEvent>> onActionProperty
The action, which is invoked whenever the MenuItem is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programatically invokes the `fire()` method.

See Also:
  - `getOnAction()`
  - `setOnAction(EventHandler)`
  - `onActionProperty()`

### onMenuValidation

public final ObjectProperty<EventHandler<Event>> onMenuValidationProperty
The event handler that is associated with invocation of an accelerator for a MenuItem. This can happen when a key sequence for an accelerator is pressed. The event handler is also invoked when onShowing event handler is called.

Since:
  JavaFX 2.2
See Also:
  - `getOnMenuValidation()`
  - `setOnMenuValidation(EventHandler)`
  - `onMenuValidationProperty()`

### disable

public final BooleanProperty disableProperty
Sets the individual disabled state of this MenuItem. Setting disable to true will cause this MenuItem to become disabled.

See Also:
  - `isDisable()`
  - `setDisable(boolean)`
  - `disableProperty()`

### visible

public final BooleanProperty visibleProperty
Specifies whether this MenuItem should be rendered as part of the scene graph.

See Also:
  - `isVisible()`
  - `setVisible(boolean)`
  - `visibleProperty()`

### accelerator

public final ObjectProperty<KeyCombination> acceleratorProperty
The accelerator property enables accessing the associated action in one keystroke. It is a convenience offered to perform quickly a given action.

See Also:
  - `getAccelerator()`
  - `setAccelerator(KeyCombination)`
  - `acceleratorProperty()`

### mnemonicParsing

public final BooleanProperty mnemonicParsingProperty
MnemonicParsing property to enable/disable text parsing. If this is set to true, then the MenuItem text will be parsed to see if it contains the mnemonic parsing character '_'. When a mnemonic is detected the key combination will be determined based on the succeeding character, and the mnemonic added.

The default value for MenuItem is true.

See Also:
  - `isMnemonicParsing()`
  - `setMnemonicParsing(boolean)`
  - `mnemonicParsingProperty()`

## Field Details

### MENU_VALIDATION_EVENT

public static final EventType<Event> MENU_VALIDATION_EVENT

Called when a accelerator for the Menuitem is invoked

Since:
  JavaFX 2.2

## Constructor Details

### MenuItem

public MenuItem()
Constructs a MenuItem with no display text.

### MenuItem

public MenuItem(String text)
Constructs a MenuItem and sets the display text with the specified text

Parameters:
  `text` - the display text
See Also:
  - `setText(java.lang.String)`

### MenuItem

public MenuItem(String text, Node graphic)
Constructor s MenuItem and sets the display text with the specified text and sets the graphic `Node` to the given node.

Parameters:
  `text` - the display text
  `graphic` - the graphic node
See Also:
  - `setText(java.lang.String)`
  - `setGraphic(javafx.scene.Node)`

## Method Details

### setId

public final void setId(String value)
Sets the value of the `id` property.

Property description:
  The id of this MenuItem. This simple string identifier is useful for finding a specific MenuItem within the scene graph.
Parameters:
  `value` - the value for the `id` property
See Also:
  - `getId()`
  - `idProperty()`

### getId

public final String getId()
Gets the value of the `id` property.

Specified by:
  `getId` in interface `Styleable`
Property description:
  The id of this MenuItem. This simple string identifier is useful for finding a specific MenuItem within the scene graph.
Returns:
  the value of the `id` property
See Also:
  - `setId(String)`
  - `idProperty()`

### idProperty

public final StringProperty idProperty()
The id of this MenuItem. This simple string identifier is useful for finding a specific MenuItem within the scene graph.

Returns:
  the `id` property
See Also:
  - `getId()`
  - `setId(String)`

### setStyle

public final void setStyle(String value)
Sets the value of the `style` property.

Property description:
  A string representation of the CSS style associated with this specific MenuItem. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.
Parameters:
  `value` - the value for the `style` property
See Also:
  - `getStyle()`
  - `styleProperty()`

### getStyle

public final String getStyle()
Gets the value of the `style` property.

Specified by:
  `getStyle` in interface `Styleable`
Property description:
  A string representation of the CSS style associated with this specific MenuItem. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.
Returns:
  the value of the `style` property
See Also:
  - `setStyle(String)`
  - `styleProperty()`

### styleProperty

public final StringProperty styleProperty()
A string representation of the CSS style associated with this specific MenuItem. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.

Returns:
  the `style` property
See Also:
  - `getStyle()`
  - `setStyle(String)`

### setParentMenu

protected final void setParentMenu(Menu value)
Sets the value of the `parentMenu` property.

Property description:
  This is the `Menu` in which this `MenuItem` exists. It is possible for an instance of this class to not have a `parentMenu` - this means that this instance is either:
  - Not yet associated with its `parentMenu`.
  - A 'root' `Menu` (i.e. it is a context menu, attached directly to a `MenuBar`, `MenuButton`, or any of the other controls that use `Menu` internally.
Parameters:
  `value` - the value for the `parentMenu` property
See Also:
  - `getParentMenu()`
  - `parentMenuProperty()`

### getParentMenu

public final Menu getParentMenu()
Gets the value of the `parentMenu` property.

Property description:
  This is the `Menu` in which this `MenuItem` exists. It is possible for an instance of this class to not have a `parentMenu` - this means that this instance is either:
  - Not yet associated with its `parentMenu`.
  - A 'root' `Menu` (i.e. it is a context menu, attached directly to a `MenuBar`, `MenuButton`, or any of the other controls that use `Menu` internally.
Returns:
  the value of the `parentMenu` property
See Also:
  - `setParentMenu(Menu)`
  - `parentMenuProperty()`

### parentMenuProperty

public final ReadOnlyObjectProperty<Menu> parentMenuProperty()
This is the `Menu` in which this `MenuItem` exists. It is possible for an instance of this class to not have a `parentMenu` - this means that this instance is either:

- Not yet associated with its `parentMenu`.
- A 'root' `Menu` (i.e. it is a context menu, attached directly to a `MenuBar`, `MenuButton`, or any of the other controls that use `Menu` internally.

Returns:
  the `parentMenu` property
See Also:
  - `getParentMenu()`
  - `setParentMenu(Menu)`

### setParentPopup

protected final void setParentPopup(ContextMenu value)
Sets the value of the `parentPopup` property.

Property description:
  This is the `ContextMenu` in which this `MenuItem` exists.
Parameters:
  `value` - the value for the `parentPopup` property
See Also:
  - `getParentPopup()`
  - `parentPopupProperty()`

### getParentPopup

public final ContextMenu getParentPopup()
Gets the value of the `parentPopup` property.

Property description:
  This is the `ContextMenu` in which this `MenuItem` exists.
Returns:
  the value of the `parentPopup` property
See Also:
  - `setParentPopup(ContextMenu)`
  - `parentPopupProperty()`

### parentPopupProperty

public final ReadOnlyObjectProperty<ContextMenu> parentPopupProperty()
This is the `ContextMenu` in which this `MenuItem` exists.

Returns:
  the `parentPopup` property
See Also:
  - `getParentPopup()`
  - `setParentPopup(ContextMenu)`

### setText

public final void setText(String value)
Sets the value of the `text` property.

Property description:
  The text to display in the `MenuItem`.
Parameters:
  `value` - the value for the `text` property
See Also:
  - `getText()`
  - `textProperty()`

### getText

public final String getText()
Gets the value of the `text` property.

Property description:
  The text to display in the `MenuItem`.
Returns:
  the value of the `text` property
See Also:
  - `setText(String)`
  - `textProperty()`

### textProperty

public final StringProperty textProperty()
The text to display in the `MenuItem`.

Returns:
  the `text` property
See Also:
  - `getText()`
  - `setText(String)`

### setGraphic

public final void setGraphic(Node value)
Sets the value of the `graphic` property.

Property description:
  An optional graphic for the `MenuItem`. This will normally be an `ImageView` node, but there is no requirement for this to be the case.
Parameters:
  `value` - the value for the `graphic` property
See Also:
  - `getGraphic()`
  - `graphicProperty()`

### getGraphic

public final Node getGraphic()
Gets the value of the `graphic` property.

Property description:
  An optional graphic for the `MenuItem`. This will normally be an `ImageView` node, but there is no requirement for this to be the case.
Returns:
  the value of the `graphic` property
See Also:
  - `setGraphic(Node)`
  - `graphicProperty()`

### graphicProperty

public final ObjectProperty<Node> graphicProperty()
An optional graphic for the `MenuItem`. This will normally be an `ImageView` node, but there is no requirement for this to be the case.

Returns:
  the `graphic` property
See Also:
  - `getGraphic()`
  - `setGraphic(Node)`

### setOnAction

public final void setOnAction(EventHandler<ActionEvent> value)
Sets the value of the `onAction` property.

Property description:
  The action, which is invoked whenever the MenuItem is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programatically invokes the `fire()` method.
Parameters:
  `value` - the value for the `onAction` property
See Also:
  - `getOnAction()`
  - `onActionProperty()`

### getOnAction

public final EventHandler<ActionEvent> getOnAction()
Gets the value of the `onAction` property.

Property description:
  The action, which is invoked whenever the MenuItem is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programatically invokes the `fire()` method.
Returns:
  the value of the `onAction` property
See Also:
  - `setOnAction(EventHandler)`
  - `onActionProperty()`

### onActionProperty

public final ObjectProperty<EventHandler<ActionEvent>> onActionProperty()
The action, which is invoked whenever the MenuItem is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programatically invokes the `fire()` method.

Returns:
  the `onAction` property
See Also:
  - `getOnAction()`
  - `setOnAction(EventHandler)`

### setOnMenuValidation

public final void setOnMenuValidation(EventHandler<Event> value)
Sets the value of the `onMenuValidation` property.

Property description:
  The event handler that is associated with invocation of an accelerator for a MenuItem. This can happen when a key sequence for an accelerator is pressed. The event handler is also invoked when onShowing event handler is called.
Parameters:
  `value` - the value for the `onMenuValidation` property
Since:
  JavaFX 2.2
See Also:
  - `getOnMenuValidation()`
  - `onMenuValidationProperty()`

### getOnMenuValidation

public final EventHandler<Event> getOnMenuValidation()
Gets the value of the `onMenuValidation` property.

Property description:
  The event handler that is associated with invocation of an accelerator for a MenuItem. This can happen when a key sequence for an accelerator is pressed. The event handler is also invoked when onShowing event handler is called.
Returns:
  the value of the `onMenuValidation` property
Since:
  JavaFX 2.2
See Also:
  - `setOnMenuValidation(EventHandler)`
  - `onMenuValidationProperty()`

### onMenuValidationProperty

public final ObjectProperty<EventHandler<Event>> onMenuValidationProperty()
The event handler that is associated with invocation of an accelerator for a MenuItem. This can happen when a key sequence for an accelerator is pressed. The event handler is also invoked when onShowing event handler is called.

Returns:
  the `onMenuValidation` property
Since:
  JavaFX 2.2
See Also:
  - `getOnMenuValidation()`
  - `setOnMenuValidation(EventHandler)`

### setDisable

public final void setDisable(boolean value)
Sets the value of the `disable` property.

Property description:
  Sets the individual disabled state of this MenuItem. Setting disable to true will cause this MenuItem to become disabled.
Parameters:
  `value` - the value for the `disable` property
See Also:
  - `isDisable()`
  - `disableProperty()`

### isDisable

public final boolean isDisable()
Gets the value of the `disable` property.

Property description:
  Sets the individual disabled state of this MenuItem. Setting disable to true will cause this MenuItem to become disabled.
Returns:
  the value of the `disable` property
See Also:
  - `setDisable(boolean)`
  - `disableProperty()`

### disableProperty

public final BooleanProperty disableProperty()
Sets the individual disabled state of this MenuItem. Setting disable to true will cause this MenuItem to become disabled.

Returns:
  the `disable` property
See Also:
  - `isDisable()`
  - `setDisable(boolean)`

### setVisible

public final void setVisible(boolean value)
Sets the value of the `visible` property.

Property description:
  Specifies whether this MenuItem should be rendered as part of the scene graph.
Parameters:
  `value` - the value for the `visible` property
See Also:
  - `isVisible()`
  - `visibleProperty()`

### isVisible

public final boolean isVisible()
Gets the value of the `visible` property.

Property description:
  Specifies whether this MenuItem should be rendered as part of the scene graph.
Returns:
  the value of the `visible` property
See Also:
  - `setVisible(boolean)`
  - `visibleProperty()`

### visibleProperty

public final BooleanProperty visibleProperty()
Specifies whether this MenuItem should be rendered as part of the scene graph.

Returns:
  the `visible` property
See Also:
  - `isVisible()`
  - `setVisible(boolean)`

### setAccelerator

public final void setAccelerator(KeyCombination value)
Sets the value of the `accelerator` property.

Property description:
  The accelerator property enables accessing the associated action in one keystroke. It is a convenience offered to perform quickly a given action.
Parameters:
  `value` - the value for the `accelerator` property
See Also:
  - `getAccelerator()`
  - `acceleratorProperty()`

### getAccelerator

public final KeyCombination getAccelerator()
Gets the value of the `accelerator` property.

Property description:
  The accelerator property enables accessing the associated action in one keystroke. It is a convenience offered to perform quickly a given action.
Returns:
  the value of the `accelerator` property
See Also:
  - `setAccelerator(KeyCombination)`
  - `acceleratorProperty()`

### acceleratorProperty

public final ObjectProperty<KeyCombination> acceleratorProperty()
The accelerator property enables accessing the associated action in one keystroke. It is a convenience offered to perform quickly a given action.

Returns:
  the `accelerator` property
See Also:
  - `getAccelerator()`
  - `setAccelerator(KeyCombination)`

### setMnemonicParsing

public final void setMnemonicParsing(boolean value)
Sets the value of the `mnemonicParsing` property.

Property description:
  MnemonicParsing property to enable/disable text parsing. If this is set to true, then the MenuItem text will be parsed to see if it contains the mnemonic parsing character '_'. When a mnemonic is detected the key combination will be determined based on the succeeding character, and the mnemonic added.

  The default value for MenuItem is true.

Parameters:
  `value` - the value for the `mnemonicParsing` property
See Also:
  - `isMnemonicParsing()`
  - `mnemonicParsingProperty()`

### isMnemonicParsing

public final boolean isMnemonicParsing()
Gets the value of the `mnemonicParsing` property.

Property description:
  MnemonicParsing property to enable/disable text parsing. If this is set to true, then the MenuItem text will be parsed to see if it contains the mnemonic parsing character '_'. When a mnemonic is detected the key combination will be determined based on the succeeding character, and the mnemonic added.

  The default value for MenuItem is true.

Returns:
  the value of the `mnemonicParsing` property
See Also:
  - `setMnemonicParsing(boolean)`
  - `mnemonicParsingProperty()`

### mnemonicParsingProperty

public final BooleanProperty mnemonicParsingProperty()
MnemonicParsing property to enable/disable text parsing. If this is set to true, then the MenuItem text will be parsed to see if it contains the mnemonic parsing character '_'. When a mnemonic is detected the key combination will be determined based on the succeeding character, and the mnemonic added.

The default value for MenuItem is true.

Returns:
  the `mnemonicParsing` property
See Also:
  - `isMnemonicParsing()`
  - `setMnemonicParsing(boolean)`

### getStyleClass

public ObservableList<String> getStyleClass()
* Public API * *

Specified by:
  `getStyleClass` in interface `Styleable`
Returns:
  a list of String identifiers which can be used to logically group Nodes, specifically for an external style engine
See Also:
  - CSS3 class selectors

### fire

public void fire()
Fires a new ActionEvent.

### addEventHandler

public <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)
Registers an event handler to this MenuItem. The handler is called when the menu item receives an `Event` of the specified type during the bubbling phase of event delivery.

Type Parameters:
  `E` - the specific event class of the handler
Parameters:
  `eventType` - the type of the events to receive by the handler
  `eventHandler` - the handler to register
Throws:
  `NullPointerException` - if the event type or handler is null

### removeEventHandler

public <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)
Unregisters a previously registered event handler from this MenuItem. One handler might have been registered for different event types, so the caller needs to specify the particular event type from which to unregister the handler.

Type Parameters:
  `E` - the specific event class of the handler
Parameters:
  `eventType` - the event type from which to unregister
  `eventHandler` - the handler to unregister
Throws:
  `NullPointerException` - if the event type or handler is null

### buildEventDispatchChain

public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this `EventTarget`. This event target is not automatically added to the chain, so if it wants to process events, it needs to add an `EventDispatcher` for itself to the chain.

In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.

The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.

The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.

Specified by:
  `buildEventDispatchChain` in interface `EventTarget`
Parameters:
  `tail` - the initial chain to build from
Returns:
  the resulting event dispatch chain for this target

### getUserData

public Object getUserData()
Returns a previously set Object property, or null if no such property has been set using the `setUserData(java.lang.Object)` method.

Returns:
  The Object that was previously set, or null if no property has been set or if null was set.

### setUserData

public void setUserData(Object value)
Convenience method for setting a single Object property that can be retrieved at a later date. This is functionally equivalent to calling the getProperties().put(Object key, Object value) method. This can later be retrieved by calling `Node.getUserData()`.

Parameters:
  `value` - The value to be stored - this can later be retrieved by calling `Node.getUserData()`.

### getProperties

public ObservableMap<Object,Object> getProperties()
Returns an observable map of properties on this menu item for use primarily by application developers.

Returns:
  an observable map of properties on this menu item for use primarily by application developers

### getTypeSelector

public String getTypeSelector()
The type of this `Styleable` that is to be used in selector matching. This is analogous to an "element" in HTML. (CSS Type Selector).

Specified by:
  `getTypeSelector` in interface `Styleable`
Returns:
  "MenuItem"
Since:
  JavaFX 8.0

### getStyleableParent

public Styleable getStyleableParent()
Return the parent of this Styleable, or null if there is no parent.

Specified by:
  `getStyleableParent` in interface `Styleable`
Returns:
  `getParentMenu()`, or `getParentPopup()` if `parentMenu` is null
Since:
  JavaFX 8.0

### getPseudoClassStates

public final ObservableSet<PseudoClass> getPseudoClassStates()
Return the pseudo-class state of this Styleable. CSS assumes this set is read-only.

Specified by:
  `getPseudoClassStates` in interface `Styleable`
Returns:
  the pseudo-class state
Since:
  JavaFX 8.0

### getCssMetaData

public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Description copied from interface: `Styleable`
The CssMetaData of this Styleable. This may be returned as an unmodifiable list.

Specified by:
  `getCssMetaData` in interface `Styleable`
Returns:
  the CssMetaData

### getStyleableNode

public Node getStyleableNode()
Returns the Node that represents this Styleable object. This method should be overridden in cases where the Styleable is not itself a Node, so that it may optionally return the relevant root node representation of itself. By default this method returns null, which can mean that either the Styleable itself is a Node, or if that is not the case, that the Styleable does not have a node representation available at the time of request.

Specified by:
  `getStyleableNode` in interface `Styleable`
Returns:
  the Node that represents this Styleable object

### toString

public String toString()

Overrides:
  `toString` in class `Object`