Class Button

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

public class Button extends ButtonBase
Author:
Bruno Salmon
  • Property Details

  • Field Details

    • PADDING

      public static final Insets PADDING
  • Constructor Details

    • Button

      public Button()
      Creates a button with an empty string for its label.
    • Button

      public Button(String text)
      Creates a button with the specified text as its label.
      Parameters:
      text - A text string for its label.
    • Button

      public Button(String text, Node graphic)
      Creates a button with the specified text and icon for its label.
      Parameters:
      text - A text string for its label.
      graphic - the icon for its label.
  • Method Details

    • setDefaultButton

      public final void setDefaultButton(boolean value)
      Sets the value of the defaultButton property.
      Property description:
      A default Button is the button that receives a keyboard VK_ENTER press, if no other node in the scene consumes it.
      Parameters:
      value - the value for the defaultButton property
      See Also:
    • isDefaultButton

      public final boolean isDefaultButton()
    • defaultButtonProperty

      public final Property<Boolean> defaultButtonProperty()
      A default Button is the button that receives a keyboard VK_ENTER press, if no other node in the scene consumes it.
      Returns:
      the defaultButton property
      See Also:
    • setCancelButton

      public final void setCancelButton(boolean value)
      Sets the value of the cancelButton property.
      Property description:
      A Cancel Button is the button that receives a keyboard VK_ESC press, if no other node in the scene consumes it.
      Parameters:
      value - the value for the cancelButton property
      See Also:
    • isCancelButton

      public final boolean isCancelButton()
    • cancelButtonProperty

      public final Property<Boolean> cancelButtonProperty()
      A Cancel Button is the button that receives a keyboard VK_ESC press, if no other node in the scene consumes it.
      Returns:
      the cancelButton property
      See Also:
    • fire

      public 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 ButtonBase.arm().

      Specified by:
      fire in class ButtonBase
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Description copied from class: Control
      Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
      Overrides:
      createDefaultSkin in class Control
      Returns:
      new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.