Class ButtonBase

All Implemented Interfaces:
LayoutMeasurable, LayoutMeasurableMixin, HasAlignmentProperty, HasBackgroundProperty, HasBlendModeProperty, HasBorderProperty, HasClipProperty, HasEffectProperty, HasFontProperty, HasGraphicProperty, HasHeightProperty, HasImageUrlProperty, HasLayoutXProperty, HasLayoutYProperty, HasManagedProperty, HasMaxHeightProperty, HasMaxWidthProperty, HasMinHeightProperty, HasMinWidthProperty, HasMouseTransparentProperty, HasOnMouseClickedProperty, HasOpacityProperty, HasPaddingProperty, HasParentProperty, HasPrefHeightProperty, HasPrefWidthProperty, HasSnapToPixelProperty, HasTextAlignmentProperty, HasTextFillProperty, HasTextProperty, HasVisibleProperty, HasWidthProperty, Styleable, EventTarget, Skinnable, INode, PreferenceResizableNode
Direct Known Subclasses:
Button, CheckBox, Hyperlink, ToggleButton

public abstract class ButtonBase extends Labeled
Author:
Bruno Salmon
  • Property Details

    • armed

      public final ReadOnlyProperty<Boolean> armedProperty
      Indicates that the button has been "armed" such that a mouse release will cause the button's action to be invoked. This is subtly different from pressed. Pressed indicates that the mouse has been pressed on a Node and has not yet been released. arm however also takes into account whether the mouse is actually over the button and pressed.
      See Also:
    • onAction

      public final ObjectProperty<EventHandler<ActionEvent>> onActionProperty
      The button's action, which is invoked whenever the button is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programmatically invokes the fire() method.
      See Also:
  • Constructor Details

    • ButtonBase

      public ButtonBase()
    • ButtonBase

      public ButtonBase(String text)
    • ButtonBase

      public ButtonBase(String text, Node graphic)
  • Method Details

    • armedProperty

      public final ReadOnlyProperty<Boolean> armedProperty()
      Indicates that the button has been "armed" such that a mouse release will cause the button's action to be invoked. This is subtly different from pressed. Pressed indicates that the mouse has been pressed on a Node and has not yet been released. arm however also takes into account whether the mouse is actually over the button and pressed.
      Returns:
      the armed property
    • isArmed

      public final boolean isArmed()
    • onActionProperty

      public final ObjectProperty<EventHandler<ActionEvent>> onActionProperty()
      The button's action, which is invoked whenever the button is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programmatically invokes the fire() method.
      Returns:
      the onAction property
      See Also:
    • setOnAction

      public final void setOnAction(EventHandler<ActionEvent> value)
      Sets the value of the onAction property.
      Property description:
      The button's action, which is invoked whenever the button is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programmatically invokes the fire() method.
      Parameters:
      value - the value for the onAction property
      See Also:
    • getOnAction

      public final EventHandler<ActionEvent> getOnAction()
      Gets the value of the onAction property.
      Property description:
      The button's action, which is invoked whenever the button is fired. This may be due to the user clicking on the button with the mouse, or by a touch event, or by a key press, or if the developer programmatically invokes the fire() method.
      Returns:
      the value of the onAction property
      See Also:
    • arm

      public void arm()
      Arms the button. An armed button will fire an action (whether that be the action of a Button or toggling selection on a CheckBox or some other behavior) on the next expected UI gesture.
    • disarm

      public void disarm()
      Disarms the button. See arm().
    • fire

      public abstract void fire()
      Invoked when a user gesture indicates that an event for this ButtonBase should occur.

      If invoked, this method will be executed regardless of the status of arm().