Module MaterialFX

Class MFXButton

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class MFXButton extends Button
This is the implementation of a button following Google's material design guidelines in JavaFX.

Extends Button, redefines the style class to "mfx-button" for usage in CSS and includes a RippleGenerator to generate ripple effects on click.

  • Property Details

  • Constructor Details

    • MFXButton

      public MFXButton()
    • MFXButton

      public MFXButton(String text)
    • MFXButton

      public MFXButton(String text, double prefWidth, double prefHeight)
    • MFXButton

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

    • getRippleGenerator

      public MFXCircleRippleGenerator getRippleGenerator()
    • setupRippleGenerator

      protected void setupRippleGenerator()
      Binds the button's ripple properties to the ripple generator ones.
    • isComputeRadiusMultiplier

      public boolean isComputeRadiusMultiplier()
      Gets the value of the property computeRadiusMultiplier.
      Property description:
      Specifies if the rippleRadiusMultiplierProperty() should be computed automatically.
    • computeRadiusMultiplierProperty

      public BooleanProperty computeRadiusMultiplierProperty()
      Specifies if the rippleRadiusMultiplierProperty() should be computed automatically.
      See Also:
    • setComputeRadiusMultiplier

      public void setComputeRadiusMultiplier(boolean computeRadiusMultiplier)
      Sets the value of the property computeRadiusMultiplier.
      Property description:
      Specifies if the rippleRadiusMultiplierProperty() should be computed automatically.
    • isRippleAnimateBackground

      public boolean isRippleAnimateBackground()
      Gets the value of the property rippleAnimateBackground.
      Property description:
      Specifies if the button's background should also be animated.
    • rippleAnimateBackgroundProperty

      public BooleanProperty rippleAnimateBackgroundProperty()
      Specifies if the button's background should also be animated.
      See Also:
    • setRippleAnimateBackground

      public void setRippleAnimateBackground(boolean rippleAnimateBackground)
      Sets the value of the property rippleAnimateBackground.
      Property description:
      Specifies if the button's background should also be animated.
    • isRippleAnimateShadow

      public boolean isRippleAnimateShadow()
      Gets the value of the property rippleAnimateShadow.
      Property description:
      Specifies if the button's shadow should also be animated.
    • rippleAnimateShadowProperty

      public BooleanProperty rippleAnimateShadowProperty()
      Specifies if the button's shadow should also be animated.
      See Also:
    • setRippleAnimateShadow

      public void setRippleAnimateShadow(boolean rippleAnimateShadow)
      Sets the value of the property rippleAnimateShadow.
      Property description:
      Specifies if the button's shadow should also be animated.
    • getRippleAnimationSpeed

      public double getRippleAnimationSpeed()
      Gets the value of the property rippleAnimationSpeed.
      Property description:
      Specifies the ripple generator's animations speed.
    • rippleAnimationSpeedProperty

      public DoubleProperty rippleAnimationSpeedProperty()
      Specifies the ripple generator's animations speed.
      See Also:
    • setRippleAnimationSpeed

      public void setRippleAnimationSpeed(double rippleAnimationSpeed)
      Sets the value of the property rippleAnimationSpeed.
      Property description:
      Specifies the ripple generator's animations speed.
    • getRippleBackgroundOpacity

      public double getRippleBackgroundOpacity()
      Gets the value of the property rippleBackgroundOpacity.
      Property description:
      Specifies the opacity for the background animation. (if rippleAnimateBackgroundProperty() is true).
    • rippleBackgroundOpacityProperty

      public DoubleProperty rippleBackgroundOpacityProperty()
      Specifies the opacity for the background animation. (if rippleAnimateBackgroundProperty() is true).
      See Also:
    • setRippleBackgroundOpacity

      public void setRippleBackgroundOpacity(double rippleBackgroundOpacity)
      Sets the value of the property rippleBackgroundOpacity.
      Property description:
      Specifies the opacity for the background animation. (if rippleAnimateBackgroundProperty() is true).
    • getRippleColor

      public final Paint getRippleColor()
      Gets the value of the property rippleColor.
      Property description:
      Specifies the ripples color of this control.
    • rippleColorProperty

      public final ObjectProperty<Paint> rippleColorProperty()
      Specifies the ripples color of this control.
      See Also:
    • setRippleColor

      public final void setRippleColor(Paint rippleColor)
      Sets the value of the property rippleColor.
      Property description:
      Specifies the ripples color of this control.
    • getRippleRadius

      public double getRippleRadius()
      Gets the value of the property rippleRadius.
      Property description:
      Specifies the radius of the ripples.
    • rippleRadiusProperty

      public DoubleProperty rippleRadiusProperty()
      Specifies the radius of the ripples.
      See Also:
    • setRippleRadius

      public void setRippleRadius(double rippleRadius)
      Sets the value of the property rippleRadius.
      Property description:
      Specifies the radius of the ripples.
    • getRippleRadiusMultiplier

      public double getRippleRadiusMultiplier()
      Gets the value of the property rippleRadiusMultiplier.
      Property description:
      Specifies the number by which the ripples' radius will be multiplied.
    • rippleRadiusMultiplierProperty

      public DoubleProperty rippleRadiusMultiplierProperty()
      Specifies the number by which the ripples' radius will be multiplied.
      See Also:
    • setRippleRadiusMultiplier

      public void setRippleRadiusMultiplier(double rippleRadiusMultiplier)
      Sets the value of the property rippleRadiusMultiplier.
      Property description:
      Specifies the number by which the ripples' radius will be multiplied.
    • getDepthLevel

      public DepthLevel getDepthLevel()
      Gets the value of the property depthLevel.
      Property description:
      Specifies how intense is the DropShadow effect applied to this control.

      The DropShadow effect is used to make the control appear RAISED.

    • depthLevelProperty

      public StyleableObjectProperty<DepthLevel> depthLevelProperty()
      Specifies how intense is the DropShadow effect applied to this control.

      The DropShadow effect is used to make the control appear RAISED.

      See Also:
    • setDepthLevel

      public void setDepthLevel(DepthLevel depthLevel)
      Sets the value of the property depthLevel.
      Property description:
      Specifies how intense is the DropShadow effect applied to this control.

      The DropShadow effect is used to make the control appear RAISED.

    • getButtonType

      public ButtonType getButtonType()
      Gets the value of the property buttonType.
      Property description:
      Specifies the appearance of this control. According to material design there are two types of buttons:

      - FLAT

      - RAISED

      If the new type is FLAT then setEffect(null) is called so that a user can also specify it's own effects for the button.
    • buttonTypeProperty

      public StyleableObjectProperty<ButtonType> buttonTypeProperty()
      Specifies the appearance of this control. According to material design there are two types of buttons:

      - FLAT

      - RAISED

      If the new type is FLAT then setEffect(null) is called so that a user can also specify it's own effects for the button.
      See Also:
    • setButtonType

      public void setButtonType(ButtonType buttonType)
      Sets the value of the property buttonType.
      Property description:
      Specifies the appearance of this control. According to material design there are two types of buttons:

      - FLAT

      - RAISED

      If the new type is FLAT then setEffect(null) is called so that a user can also specify it's own effects for the button.
    • getControlCssMetaDataList

      public static List<CssMetaData<? extends Styleable,?>> getControlCssMetaDataList()
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Button
    • getControlCssMetaData

      public List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
      Overrides:
      getControlCssMetaData in class Labeled
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region