Class PlusMinusSlider

  • All Implemented Interfaces:
    javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable

    public class PlusMinusSlider
    extends javafx.scene.control.Control
    A plus minus slider allows the user to continously fire an event carrying a value between -1 and +1 by moving a thumb from its center position to the left or right (or top and bottom) edge of the control. The thumb will automatically center itself again on the zero position when the user lets go of the mouse button. Scrolling through a large list of items at different speeds is one possible use case for a control like this.
    Screenshot of PlusMinusSlider
    • Field Summary

      • Fields inherited from class javafx.scene.layout.Region

        USE_COMPUTED_SIZE, USE_PREF_SIZE
      • Fields inherited from class javafx.scene.Node

        BASELINE_OFFSET_SAME_AS_HEIGHT
    • Constructor Summary

      Constructors 
      Constructor Description
      PlusMinusSlider()
      Constructs a new adjuster control with a default horizontal orientation.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected javafx.scene.control.Skin<?> createDefaultSkin()  
      static List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getClassCssMetaData()  
      List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getControlCssMetaData()
      javafx.event.EventHandler<PlusMinusSlider.PlusMinusEvent> getOnValueChanged()
      Returns the event handler that will be notified when the adjuster's value changes.
      javafx.geometry.Orientation getOrientation()
      Returns the value of the orientation property.
      String getUserAgentStylesheet()
      protected String getUserAgentStylesheet​(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once.
      double getValue()
      Returns the value of the value property.
      javafx.beans.property.ObjectProperty<javafx.event.EventHandler<PlusMinusSlider.PlusMinusEvent>> onValueChangedProperty()
      Stores the event handler that will be informed when the adjuster's value changes.
      javafx.beans.property.ObjectProperty<javafx.geometry.Orientation> orientationProperty()
      Returns the stylable object property used for storing the orientation of the adjuster control.
      void setOnValueChanged​(javafx.event.EventHandler<PlusMinusSlider.PlusMinusEvent> value)
      Sets an event handler that will receive plus minus events when the user moves the adjuster's thumb.
      void setOrientation​(javafx.geometry.Orientation value)
      Sets the value of the orientation property.
      javafx.beans.property.ReadOnlyDoubleProperty valueProperty()
      Returns the value property of the adjuster.
      • Methods inherited from class javafx.scene.control.Control

        computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
      • Methods inherited from class javafx.scene.layout.Region

        backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
      • Methods inherited from class javafx.scene.Parent

        getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
      • Methods inherited from class javafx.scene.Node

        accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
      • Methods inherited from interface javafx.css.Styleable

        getStyleableNode
    • Constructor Detail

      • PlusMinusSlider

        public PlusMinusSlider()
        Constructs a new adjuster control with a default horizontal orientation.
    • Method Detail

      • getUserAgentStylesheet

        public String getUserAgentStylesheet()
        Overrides:
        getUserAgentStylesheet in class javafx.scene.layout.Region
      • createDefaultSkin

        protected javafx.scene.control.Skin<?> createDefaultSkin()
        Overrides:
        createDefaultSkin in class javafx.scene.control.Control
      • valueProperty

        public final javafx.beans.property.ReadOnlyDoubleProperty valueProperty()
        Returns the value property of the adjuster. The value is always between -1 and +1.
        Returns:
        the value of the adjuster
      • getValue

        public final double getValue()
        Returns the value of the value property.
        Returns:
        the value of the adjuster [-1, +1]
        See Also:
        valueProperty()
      • setOrientation

        public final void setOrientation​(javafx.geometry.Orientation value)
        Sets the value of the orientation property.
        Parameters:
        value - the new orientation (horizontal, vertical).
        See Also:
        orientationProperty()
      • getOrientation

        public final javafx.geometry.Orientation getOrientation()
        Returns the value of the orientation property.
        Returns:
        the current orientation of the control
        See Also:
        orientationProperty()
      • orientationProperty

        public final javafx.beans.property.ObjectProperty<javafx.geometry.Orientation> orientationProperty()
        Returns the stylable object property used for storing the orientation of the adjuster control. The CSS property "-fx-orientation" can be used to initialize this value.
        Returns:
        the orientation property
      • onValueChangedProperty

        public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<PlusMinusSlider.PlusMinusEvent>> onValueChangedProperty()
        Stores the event handler that will be informed when the adjuster's value changes.
        Returns:
        the value change event handler property
      • setOnValueChanged

        public final void setOnValueChanged​(javafx.event.EventHandler<PlusMinusSlider.PlusMinusEvent> value)
        Sets an event handler that will receive plus minus events when the user moves the adjuster's thumb.
        Parameters:
        value - the event handler
        See Also:
        onValueChangedProperty()
      • getOnValueChanged

        public final javafx.event.EventHandler<PlusMinusSlider.PlusMinusEvent> getOnValueChanged()
        Returns the event handler that will be notified when the adjuster's value changes.
        Returns:
        An EventHandler.
      • getClassCssMetaData

        public static List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getClassCssMetaData()
        Returns:
        The CssMetaData associated with this class, which may include the CssMetaData of its super classes.
      • getControlCssMetaData

        public List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getControlCssMetaData()
        Overrides:
        getControlCssMetaData in class javafx.scene.control.Control
      • getUserAgentStylesheet

        protected final String getUserAgentStylesheet​(Class<?> clazz,
                                                      String fileName)
        A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once. Caches the external form of the resource.
        Parameters:
        clazz - the class used for the resource lookup
        fileName - the name of the user agent stylesheet
        Returns:
        the external form of the user agent stylesheet (the path)