This is the
Skin used by default by every MFXSliderl.
To be honest, I always thought that making a slider would be a much easier task, but this skin
but this skin proves just the opposite. Don't get me wrong, if you calmly read the code it is intuitive
but still, one of the most complicated skins I've ever made so far.
At the core a slider is simply a progress bar that the user can adjust with an icon (the thumb).
So, conceptually it is easy, but computing the value based on the mouse drag or press, computing the
layout based on the value, managing the popup position and visibility, positioning the ticks correctly,
the possibility to change the thumb and the popup, the bidirectional feature, all of that is quite tricky, but,
I must say that I'm happy with the final result.
A little note on how the popup visibility is managed.
The popup is shown when an arrow key is pressed or the mouse is pressed on the thumb.
To hide the popup a PauseTransition of 800 milliseconds is played and at the end
the popup is hidden.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classSupport class to the slider's skin.protected classSupport class to the slider's skin.protected static classSupport class to theMFXSliderSkin.LayoutDataclass, simple bean which contains info about the slider's major ticks such as: the tick Node, the value represented by the tick and its x position. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RectanglebuildRectangle(String styleClass) Responsible for building the track and the bars for the slider.protected NodeResponsible for creating the slider's major ticks.protected doublecomputeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) protected doublecomputeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) protected doublecomputeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) protected doublecomputePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) protected doublecomputePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) voiddispose()protected voidIf the popup is not null, hides the popup with a fade out animation.protected voidlayoutChildren(double x, double y, double w, double h) protected voidCallssliderHandlers(),sliderListeners(),skinBehavior().protected voidIf the popup is not null, stops the release timer and shows the popup with a fade in animation.Methods inherited from class javafx.scene.control.SkinBase
computeBaselineOffset, computeMinWidth, consumeMouseEvents, executeAccessibleAction, getChildren, getClassCssMetaData, getCssMetaData, getNode, getSkinnable, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, registerInvalidationListener, registerListChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners, unregisterInvalidationListeners, unregisterListChangeListeners
-
Constructor Details
-
MFXSliderSkin
-
-
Method Details
-
setBehavior
protected void setBehavior()CallssliderHandlers(),sliderListeners(),skinBehavior(). -
showPopup
protected void showPopup()If the popup is not null, stops the release timer and shows the popup with a fade in animation. -
hidePopup
protected void hidePopup()If the popup is not null, hides the popup with a fade out animation. -
buildRectangle
Responsible for building the track and the bars for the slider. -
buildTick
Responsible for creating the slider's major ticks. -
computeMinHeight
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computeMinHeightin classSkinBase<MFXSlider>
-
computePrefWidth
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computePrefWidthin classSkinBase<MFXSlider>
-
computePrefHeight
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computePrefHeightin classSkinBase<MFXSlider>
-
computeMaxWidth
protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computeMaxWidthin classSkinBase<MFXSlider>
-
computeMaxHeight
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computeMaxHeightin classSkinBase<MFXSlider>
-
dispose
public void dispose() -
layoutChildren
protected void layoutChildren(double x, double y, double w, double h) - Overrides:
layoutChildrenin classSkinBase<MFXSlider>
-