MenuItem
type (joe.win
)
The MenuItem
widget is an item in a Menu
.
- menuItem.action(callable) → this
- menuItem.disable([flag]) → this
- menuItem.getProperty(keyword) → value
- menuItem.id(id) → this
- menuItem.isDisabled() → joe.Boolean
- menuItem.listenTo(keyword, listener) → this
- menuItem.properties() → joe.Set
- menuItem.setProperty(keyword, value) → this
- menuItem.styleClasses() → joe.List
- menuItem.styles(style, ...) → this
- menuItem.text(text) → this
- menuItem.toString() → joe.String
Properties
All Node
widgets have the following properties.
Property | Type | Description |
---|---|---|
#id | String | JavaFX ID |
#onAction | callable(1) | The onAction handler |
#style | String | FXCSS style string |
#text | String | MenuItem text |
See Styling with CSS for more on using CSS.
MenuItem Initializer
MenuItem() → MenuItem
Returns a MenuItem
.
Methods
menuItem.action()
menuItem.action(callable) → this
Adds a no-arg callable to the menu item as its action; pressing the button will invoke the callable.
menuItem.disable()
menuItem.disable([flag]) → this
Sets the item's #disable
property to flag; if omitted,
flag defaults to true
. While true
, this item and its
descendants in the scene graph will be disabled.
menuItem.getProperty()
menuItem.getProperty(keyword) → value
Gets the value of the property with the given keyword.
menuItem.id()
menuItem.id(id) → this
Sets the item's #id
property to the given id string.
menuItem.isDisabled()
menuItem.isDisabled() → joe.Boolean
Returns true
if the item has been disabled, and false
otherwise.
menuItem.listenTo()
menuItem.listenTo(keyword, listener) → this
Adds a listener to the property with the given keyword. The listener should be a callable taking the three arguments:
- The property keyword
- The old value of the property
- The new value of the property
The listener will be called when the property's value changes.
menuItem.properties()
menuItem.properties() → joe.Set
Returns a readonly Set
of the object's property keywords.
menuItem.setProperty()
menuItem.setProperty(keyword, value) → this
Sets the value of the property with the given keyword. The value must be assignable to the property's value type.
menuItem.styleClasses()
menuItem.styleClasses() → joe.List
Gets the list of the item's FXCSS style class names. Values must be valid CSS style class names.
See Styling with CSS for more on using CSS.
menuItem.styles()
menuItem.styles(style, ...) → this
Sets the item's FXCSS #style
property. The caller can pass
multiple style strings, which will be joined with semicolons.
See Styling with CSS for more on using CSS.
menuItem.text()
menuItem.text(text) → this
Sets the item's text.
menuItem.toString()
menuItem.toString() → joe.String
Returns the value's string representation.