Class ButtonBehavior<C extends ButtonBase>
java.lang.Object
com.sun.javafx.scene.control.behavior.BehaviorBase<C>
com.sun.javafx.scene.control.behavior.ButtonBehavior<C>
- Direct Known Subclasses:
CheckBoxBehavior
,ToggleButtonBehavior
All of the "button" types (CheckBox, RadioButton, ToggleButton, and Button)
and also maybe some other types like hyperlinks operate on the "armed"
selection strategy, just like JButton. This behavior class encapsulates that
logic in a way that can be reused and extended by each of the individual
class behaviors.
-
Field Summary
Fields inherited from class com.sun.javafx.scene.control.behavior.BehaviorBase
IS_TOUCH_SUPPORTED, TRAVERSAL_BINDINGS
-
Constructor Summary
ConstructorDescriptionButtonBehavior
(C button) * Constructors * *ButtonBehavior
(C button, List<KeyBinding> bindings) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
callAction
(String name) Called to invoke the action associated with the given name.protected void
* Focus change handling * *void
Invoked when the mouse enters the Button.void
Invoked when the mouse exits the Button.void
Invoked when a mouse press has occurred over the button.void
Invoked when a mouse release has occurred.Methods inherited from class com.sun.javafx.scene.control.behavior.BehaviorBase
callActionForEvent, dispose, getControl, matchActionForEvent, mouseDragged
-
Field Details
-
BUTTON_BINDINGS
-
-
Constructor Details
-
ButtonBehavior
* Constructors * * -
ButtonBehavior
-
-
Method Details
-
focusChanged
protected void focusChanged()* Focus change handling * *- Overrides:
focusChanged
in classBehaviorBase<C extends ButtonBase>
-
callAction
Description copied from class:BehaviorBase
Called to invoke the action associated with the given name.When a KeyEvent is handled, it is first passed through callActionForEvent which resolves which "action" should be executed based on the key event. This action is indicated by name. This name is then passed to this function which is responsible for invoking the right function based on the name.
- Overrides:
callAction
in classBehaviorBase<C extends ButtonBase>
-
mousePressed
Invoked when a mouse press has occurred over the button. In addition to potentially arming the Button, this will transfer focus to the button- Overrides:
mousePressed
in classBehaviorBase<C extends ButtonBase>
- Parameters:
e
- the mouse event
-
mouseReleased
Invoked when a mouse release has occurred. We determine whether this was done in a manner that would fire the button's action. This happens only if the button was armed by a corresponding mouse press.- Overrides:
mouseReleased
in classBehaviorBase<C extends ButtonBase>
- Parameters:
e
- the mouse event
-
mouseEntered
Invoked when the mouse enters the Button. If the Button had been armed by a mouse press and the mouse is still pressed, then this will cause the button to be rearmed.- Overrides:
mouseEntered
in classBehaviorBase<C extends ButtonBase>
- Parameters:
e
- the mouse event
-
mouseExited
Invoked when the mouse exits the Button. If the Button is armed due to a mouse press, then this function will disarm the button upon the mouse exiting it.- Overrides:
mouseExited
in classBehaviorBase<C extends ButtonBase>
- Parameters:
e
- the mouse event
-