public class Action
extends java.lang.Object
implements javafx.event.EventHandler<javafx.event.ActionEvent>
Menu and another on a toolbar), consider
using an Action object to implement the function. An Action object provides
centralized handling of the state of action-event-firing components such as
buttons, menu items, etc. The state that an action can handle includes text,
graphic, long text (i.e. tooltip text), and disabled.| Type | Property and Description |
|---|---|
javafx.beans.property.ObjectProperty<javafx.scene.input.KeyCombination> |
accelerator
The accelerator
KeyCombination that should be used for this action,
if it is used in an applicable UI control (most notably MenuItem). |
javafx.beans.property.BooleanProperty |
disabled
This represents whether the action should be available to the end user,
or whether it should appeared 'grayed out'.
|
javafx.beans.property.ObjectProperty<javafx.scene.Node> |
graphic
The graphic that should be shown to the user in relation to this action.
|
javafx.beans.property.StringProperty |
longText
The longer form of the text to show to the user (e.g.
|
javafx.beans.property.BooleanProperty |
selected
Represents action's selected state.
|
javafx.beans.property.StringProperty |
style
A string representation of the CSS style associated with this
Action instance and passed to related UI controls.
|
javafx.beans.property.StringProperty |
text
The text to show to the user.
|
| Constructor and Description |
|---|
Action(java.util.function.Consumer<javafx.event.ActionEvent> eventHandler) |
Action(java.lang.String text)
Constructors
|
Action(java.lang.String text,
java.util.function.Consumer<javafx.event.ActionEvent> eventHandler)
Creates a new AbstractAction instance with the given String set as the
text value, as well as the Consumer<ActionEvent>
set to be called when the action event is fired. |
| Modifier and Type | Method and Description |
|---|---|
javafx.beans.property.ObjectProperty<javafx.scene.input.KeyCombination> |
acceleratorProperty()
The accelerator
KeyCombination that should be used for this action,
if it is used in an applicable UI control (most notably MenuItem). |
javafx.beans.property.BooleanProperty |
disabledProperty()
This represents whether the action should be available to the end user,
or whether it should appeared 'grayed out'.
|
javafx.scene.input.KeyCombination |
getAccelerator() |
protected java.util.function.Consumer<javafx.event.ActionEvent> |
getEventHandler() |
javafx.scene.Node |
getGraphic() |
java.lang.String |
getLongText() |
javafx.collections.ObservableMap<java.lang.Object,java.lang.Object> |
getProperties()
Returns an observable map of properties on this Action for use primarily
by application developers.
|
java.lang.String |
getStyle()
Gets the value of the property style.
|
javafx.collections.ObservableList<java.lang.String> |
getStyleClass()
A list of String identifiers which can be used to logically group
Nodes, specifically for an external style engine.
|
java.lang.String |
getText() |
javafx.beans.property.ObjectProperty<javafx.scene.Node> |
graphicProperty()
The graphic that should be shown to the user in relation to this action.
|
void |
handle(javafx.event.ActionEvent event)
Defers to the
Consumer<ActionEvent> passed in to the Action constructor. |
boolean |
isDisabled() |
boolean |
isSelected()
Selected state of the Action.
|
protected void |
lock() |
javafx.beans.property.StringProperty |
longTextProperty()
The longer form of the text to show to the user (e.g.
|
javafx.beans.property.BooleanProperty |
selectedProperty()
Represents action's selected state.
|
void |
setAccelerator(javafx.scene.input.KeyCombination value)
Sets the accelerator
KeyCombination that should be used for this action,
if it is used in an applicable UI control |
void |
setDisabled(boolean value)
Sets whether the action should be available to the end user,
or whether it should appeared 'grayed out'.
|
protected void |
setEventHandler(java.util.function.Consumer<javafx.event.ActionEvent> eventHandler) |
void |
setGraphic(javafx.scene.Node value)
Sets the graphic that should be shown to the user in relation to this action.
|
void |
setLongText(java.lang.String value)
Sets the longer form of the text to show to the user
|
void |
setSelected(boolean selected)
Sets selected state of the Action
|
void |
setStyle(java.lang.String value)
Sets the value of the property style.
|
void |
setText(java.lang.String value)
Sets the text of the Action.
|
javafx.beans.property.StringProperty |
styleProperty()
A string representation of the CSS style associated with this
Action instance and passed to related UI controls.
|
javafx.beans.property.StringProperty |
textProperty()
The text to show to the user.
|
public final javafx.beans.property.StringProperty styleProperty
Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead.
getStyle(),
setStyle(String)public final javafx.beans.property.BooleanProperty selectedProperty
isSelected(),
setSelected(boolean)public final javafx.beans.property.StringProperty textProperty
getText(),
setText(String)public final javafx.beans.property.BooleanProperty disabledProperty
isDisabled(),
setDisabled(boolean)public final javafx.beans.property.StringProperty longTextProperty
Button, it is usually a tooltip that should be shown to the user
if their mouse hovers over this action).getLongText(),
setLongText(String)public final javafx.beans.property.ObjectProperty<javafx.scene.Node> graphicProperty
getGraphic(),
setGraphic(Node)public final javafx.beans.property.ObjectProperty<javafx.scene.input.KeyCombination> acceleratorProperty
KeyCombination that should be used for this action,
if it is used in an applicable UI control (most notably MenuItem).getAccelerator(),
setAccelerator(KeyCombination)public Action(java.lang.String text)
public Action(java.util.function.Consumer<javafx.event.ActionEvent> eventHandler)
public Action(java.lang.String text,
java.util.function.Consumer<javafx.event.ActionEvent> eventHandler)
text value, as well as the Consumer<ActionEvent>
set to be called when the action event is fired.text - The string to display in the text property of controls such
as Button.eventHandler - This will be called when the ActionEvent is fired.protected void lock()
public final void setStyle(java.lang.String value)
Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead.
public final java.lang.String getStyle()
Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead.
public final javafx.beans.property.StringProperty styleProperty()
Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead.
getStyle(),
setStyle(String)public javafx.collections.ObservableList<java.lang.String> getStyleClass()
public final javafx.beans.property.BooleanProperty selectedProperty()
isSelected(),
setSelected(boolean)public final boolean isSelected()
public final void setSelected(boolean selected)
selected - public final javafx.beans.property.StringProperty textProperty()
getText(),
setText(String)public final java.lang.String getText()
public final void setText(java.lang.String value)
value - public final javafx.beans.property.BooleanProperty disabledProperty()
isDisabled(),
setDisabled(boolean)public final boolean isDisabled()
public final void setDisabled(boolean value)
value - public final javafx.beans.property.StringProperty longTextProperty()
Button, it is usually a tooltip that should be shown to the user
if their mouse hovers over this action).getLongText(),
setLongText(String)public final java.lang.String getLongText()
longTextProperty()public final void setLongText(java.lang.String value)
value - longTextProperty()public final javafx.beans.property.ObjectProperty<javafx.scene.Node> graphicProperty()
getGraphic(),
setGraphic(Node)public final javafx.scene.Node getGraphic()
public final void setGraphic(javafx.scene.Node value)
value - public final javafx.beans.property.ObjectProperty<javafx.scene.input.KeyCombination> acceleratorProperty()
KeyCombination that should be used for this action,
if it is used in an applicable UI control (most notably MenuItem).getAccelerator(),
setAccelerator(KeyCombination)public final javafx.scene.input.KeyCombination getAccelerator()
KeyCombination that should be used for this action,
if it is used in an applicable UI controlpublic final void setAccelerator(javafx.scene.input.KeyCombination value)
KeyCombination that should be used for this action,
if it is used in an applicable UI controlvalue - public final javafx.collections.ObservableMap<java.lang.Object,java.lang.Object> getProperties()
protected java.util.function.Consumer<javafx.event.ActionEvent> getEventHandler()
protected void setEventHandler(java.util.function.Consumer<javafx.event.ActionEvent> eventHandler)
public final void handle(javafx.event.ActionEvent event)
Consumer<ActionEvent> passed in to the Action constructor.handle in interface javafx.event.EventHandler<javafx.event.ActionEvent>