Module MaterialFX

Class MFXLabeledSkinBase<C extends Labeled & MFXLabeled>

java.lang.Object
javafx.scene.control.SkinBase<C>
io.github.palexdev.materialfx.skins.base.MFXLabeledSkinBase<C>
All Implemented Interfaces:
Skin<C>
Direct Known Subclasses:
MFXCheckboxSkin, MFXRadioButtonSkin, MFXToggleButtonSkin

public abstract class MFXLabeledSkinBase<C extends Labeled & MFXLabeled> extends SkinBase<C>
Common skin for all controls that implement both Labeled and MFXLabeled.
  • Field Details

  • Constructor Details

    • MFXLabeledSkinBase

      protected MFXLabeledSkinBase(C labeled)
  • Method Details

    • getControlContainer

      protected abstract Pane getControlContainer()
      To use this skin, controls must be organized in a certain way.

      Two main nodes are needed: one is the text of course, the other one is a pane which contains all the other nodes. This is necessary for the MFXLabeled.contentDispositionProperty() to work properly. This base skin defines a top container which is a BorderPane. At the center of the border pane there's always the text (exception being when content disposition is CENTER or GRAPHIC_ONLY), the other pane is the one that rotates depending on the content disposition property.

    • addListeners

      protected void addListeners()
      Adds some common listeners for all skins extending this.

      Note that this method is not called by the constructor of this class, this is to allow overriding and thus expand the behavior of this method. This should be called at the end of the constructor of the implementing skin.

    • initContainer

      protected void initContainer()
      This is responsible for managing the BorderPane when the MFXLabeled.contentDispositionProperty() and the MFXLabeled.gapProperty() change.

      Note that the gap is set by using BorderPane.setMargin(Node, Insets) on the text node.

    • updateAlignment

      protected void updateAlignment()
      This method ensures that the control's pane is always correctly aligned with the text.
    • computeMinWidth

      protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computeMinWidth in class SkinBase<C extends Labeled & MFXLabeled>
    • computeMaxWidth

      protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computeMaxWidth in class SkinBase<C extends Labeled & MFXLabeled>
    • computeMaxHeight

      protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
      Overrides:
      computeMaxHeight in class SkinBase<C extends Labeled & MFXLabeled>