Module MaterialFX

Class MFXSpinnerSkin<T>

java.lang.Object
javafx.scene.control.SkinBase<MFXSpinner<T>>
io.github.palexdev.materialfx.skins.MFXSpinnerSkin<T>
All Implemented Interfaces:
Skin<MFXSpinner<T>>

public class MFXSpinnerSkin<T> extends SkinBase<MFXSpinner<T>>
This is the default skin implementation for MFXSpinner.

There are two main components:

1) The top container, a BorderPane, which contains the spinner's text field and the two icons. The usage of a BorderPane simplifies a lot the layout since it's everything automatically handled. This allows to easily switch the spinner's orientation, MFXSpinner.orientationProperty(), and handle the icons.

2) A MFXTextField to show the spinner's selected value as text. Here things are a bit more complicated. The field's text is not simply bound but it's computed by a StringBinding. This is needed because there are several things to consider since the spinner relies on SpinnerModel to handle the selected value and also the way to convert the value to text. It's needed, for example, to keep track of both the MFXSpinner.spinnerModelProperty() and the SpinnerModel.converterProperty() at the same time.

The skin also introduces a new PseudoClass: ":focus-within", it is activated when the text field is focused or when one of the icons is focused.
  • Constructor Details

    • MFXSpinnerSkin

      public MFXSpinnerSkin(MFXSpinner<T> spinner)
  • Method Details

    • computeMinWidth

      protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computeMinWidth in class SkinBase<MFXSpinner<T>>
    • computePrefWidth

      protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computePrefWidth in class SkinBase<MFXSpinner<T>>
    • computeMaxWidth

      protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computeMaxWidth in class SkinBase<MFXSpinner<T>>
    • computeMaxHeight

      protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computeMaxHeight in class SkinBase<MFXSpinner<T>>
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Skin<T>
      Overrides:
      dispose in class SkinBase<MFXSpinner<T>>