Top Description Inners Fields Constructors Methods
org.controlsfx.control

public Class PlusMinusSlider

extends ControlsFXControl
Class Inheritance
Imports
impl.org.controlsfx.skin.PlusMinusSliderSkin, java.util.ArrayList, .Collections, .List, .UUID, javafx.beans.property.ObjectProperty, .ObjectPropertyBase, .ReadOnlyDoubleProperty, .ReadOnlyDoubleWrapper, javafx.collections.MapChangeListener, javafx.css.CssMetaData, .PseudoClass, .Styleable, .StyleableObjectProperty, .StyleableProperty, javafx.css.converter.EnumConverter, javafx.event.EventHandler, .EventTarget, .EventType, javafx.geometry.Orientation, javafx.scene.control.Control, .Skin, javafx.scene.input.InputEvent

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PlusMinusSlider.PlusMinusEvent

An event class used by the PlusMinusSlider to inform event handlers about changes.

private static class

Field Summary

Modifier and TypeField and Description
private static final String
private static final PseudoClass
private ObjectProperty<EventHandler<PlusMinusSlider.PlusMinusEvent>>
private ObjectProperty<Orientation>
private ReadOnlyDoubleWrapper
private static final PseudoClass

Constructor Summary

AccessConstructor and Description
public
PlusMinusSlider()

Constructs a new adjuster control with a default horizontal orientation.

Method Summary

Modifier and TypeMethod and Description
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public static List<CssMetaData<? extends Styleable, ?>>

Returns:

The CssMetaData associated with this class, which may include the CssMetaData of its super classes.
getClassCssMetaData
()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final EventHandler<PlusMinusSlider.PlusMinusEvent>

Returns:

An EventHandler.
getOnValueChanged
()

Returns the event handler that will be notified when the adjuster's value changes.

public final Orientation

Returns:

the current orientation of the control
getOrientation
()

Returns the value of the orientation property.

public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final double

Returns:

the value of the adjuster [-1, +1]
getValue
()

Returns the value of the value property.

public final ObjectProperty<EventHandler<PlusMinusSlider.PlusMinusEvent>>

Returns:

the value change event handler property
onValueChangedProperty
()

Stores the event handler that will be informed when the adjuster's value changes.

public final ObjectProperty<Orientation>

Returns:

the orientation property
orientationProperty
()

Returns the stylable object property used for storing the orientation of the adjuster control.

public final void
setOnValueChanged(EventHandler<PlusMinusSlider.PlusMinusEvent>
the event handler
value
)

Sets an event handler that will receive plus minus events when the user moves the adjuster's thumb.

public final void
setOrientation(Orientation
the new orientation (horizontal, vertical).
value
)

Sets the value of the orientation property.

public final ReadOnlyDoubleProperty

Returns:

the value of the adjuster
valueProperty
()

Returns the value property of the adjuster.

Inherited from org.controlsfx.control.ControlsFXControl:
getUserAgentStylesheet

Field Detail

DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS
HORIZONTAL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass HORIZONTAL_PSEUDOCLASS_STATE
onValueChangedback to summary
private ObjectProperty<EventHandler<PlusMinusSlider.PlusMinusEvent>> onValueChanged
orientationback to summary
private ObjectProperty<Orientation> orientation
valueback to summary
private ReadOnlyDoubleWrapper value
VERTICAL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass VERTICAL_PSEUDOCLASS_STATE

Constructor Detail

PlusMinusSliderback to summary
public PlusMinusSlider()

Constructs a new adjuster control with a default horizontal orientation.

Method Detail

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Doc from javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

Returns:List<CssMetaData<? extends Styleable, ?>>

The CssMetaData associated with this class, which may include the CssMetaData of its super classes.

getControlCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Annotations
@Override
getOnValueChangedback to summary
public final EventHandler<PlusMinusSlider.PlusMinusEvent> getOnValueChanged()

Returns the event handler that will be notified when the adjuster's value changes.

Returns:EventHandler<PlusMinusSlider.PlusMinusEvent>

An EventHandler.

getOrientationback to summary
public final Orientation getOrientation()

Returns the value of the orientation property.

Returns:Orientation

the current orientation of the control

See Also
orientationProperty()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
getValueback to summary
public final double getValue()

Returns the value of the value property.

Returns:double

the value of the adjuster [-1, +1]

See Also
valueProperty()
onValueChangedPropertyback to summary
public final ObjectProperty<EventHandler<PlusMinusSlider.PlusMinusEvent>> onValueChangedProperty()

Stores the event handler that will be informed when the adjuster's value changes.

Returns:ObjectProperty<EventHandler<PlusMinusSlider.PlusMinusEvent>>

the value change event handler property

orientationPropertyback to summary
public final ObjectProperty<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:ObjectProperty<Orientation>

the orientation property

setOnValueChangedback to summary
public final void setOnValueChanged(EventHandler<PlusMinusSlider.PlusMinusEvent> value)

Sets an event handler that will receive plus minus events when the user moves the adjuster's thumb.

Parameters
value:EventHandler<PlusMinusSlider.PlusMinusEvent>

the event handler

See Also
onValueChangedProperty()
setOrientationback to summary
public final void setOrientation(Orientation value)

Sets the value of the orientation property.

Parameters
value:Orientation

the new orientation (horizontal, vertical).

See Also
orientationProperty()
valuePropertyback to summary
public final ReadOnlyDoubleProperty valueProperty()

Returns the value property of the adjuster. The value is always between -1 and +1.

Returns:ReadOnlyDoubleProperty

the value of the adjuster

org.controlsfx.control back to summary

public Class PlusMinusSlider.PlusMinusEvent

extends InputEvent
Class Inheritance

An event class used by the PlusMinusSlider to inform event handlers about changes.

Field Summary

Modifier and TypeField and Description
public static final EventType<PlusMinusSlider.PlusMinusEvent>
private static final long
private double
public static final EventType<PlusMinusSlider.PlusMinusEvent>
VALUE_CHANGED

An event type used when the value property ( PlusMinusSlider#valueProperty()) changes.

Constructor Summary

AccessConstructor and Description
public
PlusMinusEvent(Object
the source of the event (always the PlusMinusSlider)
source
,
EventTarget
the target of the event (always the PlusMinusSlider)
target
,
EventType<? extends InputEvent>
the type of the event (e.g. VALUE_CHANGED)
eventType
,
double
the actual current value of the adjuster
value
)

Constructs a new event object.

Method Summary

Modifier and TypeMethod and Description
public double

Returns:

the value
getValue
()

The value of the PlusMinusSlider.

Inherited from javafx.scene.input.InputEvent:
getEventType

Field Detail

ANYback to summary
public static final EventType<PlusMinusSlider.PlusMinusEvent> ANY

Hides javafx.scene.input.InputEvent.ANY.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.scene.input.InputEvent.serialVersionUID.

valueback to summary
private double value
VALUE_CHANGEDback to summary
public static final EventType<PlusMinusSlider.PlusMinusEvent> VALUE_CHANGED

An event type used when the value property ( PlusMinusSlider#valueProperty()) changes.

Constructor Detail

PlusMinusEventback to summary
public PlusMinusEvent(Object source, EventTarget target, EventType<? extends InputEvent> eventType, double value)

Constructs a new event object.

Parameters
source:Object

the source of the event (always the PlusMinusSlider)

target:EventTarget

the target of the event (always the PlusMinusSlider)

eventType:EventType<? extends InputEvent>

the type of the event (e.g. VALUE_CHANGED)

value:double

the actual current value of the adjuster

Method Detail

getValueback to summary
public double getValue()

The value of the PlusMinusSlider.

Returns:double

the value

org.controlsfx.control back to summary

private Class PlusMinusSlider.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<PlusMinusSlider, Orientation>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ORIENTATIONback to summary
private static final CssMetaData<PlusMinusSlider, Orientation> ORIENTATION
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()