Class ButtonBehavior<C extends ButtonBase>

Direct Known Subclasses:
CheckBoxBehavior, ToggleButtonBehavior

public class ButtonBehavior<C extends ButtonBase> extends BehaviorBase<C>
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 Details


      protected static final List<KeyBinding> BUTTON_BINDINGS
  • Constructor Details

    • ButtonBehavior

      public ButtonBehavior(C button)
      * Constructors * *
    • ButtonBehavior

      public ButtonBehavior(C button, List<KeyBinding> bindings)
  • Method Details

    • focusChanged

      protected void focusChanged()
      * Focus change handling * *
      focusChanged in class BehaviorBase<C extends ButtonBase>
    • callAction

      protected void callAction(String name)
      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.

      callAction in class BehaviorBase<C extends ButtonBase>
    • mousePressed

      public 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
      mousePressed in class BehaviorBase<C extends ButtonBase>
      e - the mouse event
    • mouseReleased

      public 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.
      mouseReleased in class BehaviorBase<C extends ButtonBase>
      e - the mouse event
    • mouseEntered

      public 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.
      mouseEntered in class BehaviorBase<C extends ButtonBase>
      e - the mouse event
    • mouseExited

      public 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.
      mouseExited in class BehaviorBase<C extends ButtonBase>
      e - the mouse event