APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx.scene.control.behavior

public Class ButtonBehavior<C extends ButtonBase>

extends BehaviorBase<C extends ButtonBase>
Class Inheritance
Known Direct Subclasses
com.sun.javafx.scene.control.behavior.MenuButtonBehaviorBase, com.sun.javafx.scene.control.behavior.ToggleButtonBehavior
Imports
com.sun.javafx.PlatformUtil, com.sun.javafx.scene.control.inputmap.KeyBinding, .InputMap, javafx.beans.InvalidationListener, .Observable, javafx.scene.control.ButtonBase, javafx.scene.input.KeyEvent, .MouseButton, .MouseEvent

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

Modifier and TypeField and Description
private final InputMap<C>
private InvalidationListener
private boolean
keyDown

Indicates that a keyboard key has been pressed which represents the event (this could be space bar for example).

Constructor Summary

AccessConstructor and Description
public
ButtonBehavior(C control)

* Constructors * *

Method Summary

Modifier and TypeMethod and Description
public void
private void
focusChanged(Observable o)

* Focus change handling * *

public InputMap<C>
getInputMap()

Implements abstract com.sun.javafx.scene.control.behavior.BehaviorBase.getInputMap.

* Implementation of BehaviorBase API * *

protected void
keyPressed(KeyEvent e)

This function is invoked when an appropriate keystroke occurs which causes this button to be armed if it is not already armed by a mouse press.

protected void
keyReleased(KeyEvent e)

Invoked when a valid keystroke release occurs which causes the button to fire if it was armed by a keyPress.

protected void
mouseEntered(MouseEvent e)

Invoked when the mouse enters the Button.

protected void
mouseExited(MouseEvent e)

Invoked when the mouse exits the Button.

protected void
mousePressed(MouseEvent e)

Invoked when a mouse press has occurred over the button.

protected void
mouseReleased(MouseEvent e)

Invoked when a mouse release has occurred.

Inherited from com.sun.javafx.scene.control.behavior.BehaviorBase:
addDefaultChildMapaddDefaultMappingaddDefaultMappingaddDefaultMappingcreateInputMapgetNodeisRTLremoveMappingrtlrtl

Field Detail

buttonInputMapback to summary
private final InputMap<C> buttonInputMap
focusListenerback to summary
private InvalidationListener focusListener
keyDownback to summary
private boolean keyDown

Indicates that a keyboard key has been pressed which represents the event (this could be space bar for example). As long as keyDown is true, we are also armed, and will ignore mouse events related to arming. Note this is made package private solely for the sake of testing.

Constructor Detail

ButtonBehaviorback to summary
public ButtonBehavior(C control)

* Constructors * *

Method Detail

disposeback to summary
public void dispose()

Overrides com.sun.javafx.scene.control.behavior.BehaviorBase.dispose.

Annotations
@Override
focusChangedback to summary
private void focusChanged(Observable o)

* Focus change handling * *

getInputMapback to summary
public InputMap<C> getInputMap()

Implements abstract com.sun.javafx.scene.control.behavior.BehaviorBase.getInputMap.

* Implementation of BehaviorBase API * *

Annotations
@Override
keyPressedback to summary
protected void keyPressed(KeyEvent e)

This function is invoked when an appropriate keystroke occurs which causes this button to be armed if it is not already armed by a mouse press.

keyReleasedback to summary
protected void keyReleased(KeyEvent e)

Invoked when a valid keystroke release occurs which causes the button to fire if it was armed by a keyPress.

mouseEnteredback to summary
protected void mouseEntered(MouseEvent e)

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.

mouseExitedback to summary
protected void mouseExited(MouseEvent e)

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.

mousePressedback to summary
protected void mousePressed(MouseEvent e)

Invoked when a mouse press has occurred over the button. In addition to potentially arming the Button, this will transfer focus to the button

mouseReleasedback to summary
protected void mouseReleased(MouseEvent e)

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.