A simple button control. The button control can contain text and/or a graphic. A button control has three different modes
ENTER
key presses when it has focus. When the default button does not have focus, and focus is on another Button
control, the ENTER key press will be received by the other, non-default Button. When focus is elsewhere in
the user interface, and not on any Button, the ENTER key press will be received by the default button, if
one is specified, and if no other node in the scene consumes it first.SPACE
key.When a button is pressed and released a ActionEvent
is sent.
Your application can perform some action based on this event by implementing an
javafx.event.EventHandler
to process the ActionEvent
. Buttons can also respond to
mouse events by implementing an javafx.event.EventHandler
to process the javafx.scene.input.MouseEvent
MnemonicParsing is enabled by default for Button.
Example:
Button button = new Button("Click Me");
extends