A SwingTree builder node designed for configuring
JSlider
instances.
Please take a look at the living swing-tree documentation where you can browse a large collection of examples demonstrating how to use the API of this class.
-
Method Summary
Modifier and TypeMethodDescriptionprotected UIForSlider
<S> _newBuilderWithState
(swingtree.BuilderState<S> newState) An internal wither method which creates a new builder instance with the providedBuilderState
stored inside it.protected swingtree.BuilderState
<S> _state()
Returns the state of the builder, which is a container for the wrapped component as well as it's type and currentEventProcessor
.final UIForSlider
<S> onChange
(sprouts.Action<ComponentDelegate<JSlider, ChangeEvent>> action) Adds anAction
to the underlyingJSlider
through anChangeListener
, which will be called when the state of the slider changes.final UIForSlider
<S> withMajorTickSpacing
(int spacing) Sets the major tick spacing of the slider.final UIForSlider
<S> withMajorTickSpacing
(sprouts.Val<Integer> spacing) Dynamically sets the major tick spacing of the slider.final UIForSlider
<S> withMax
(int max) Sets the maximum value of the slider.final UIForSlider
<S> Binds the suppliedVal
property to the max value of the slider.final UIForSlider
<S> withMin
(int min) Sets the minimum value of the slider.final UIForSlider
<S> Binds the suppliedVal
property to the min value of the slider so that when the value of the property changes, the min value of the slider will be updated accordingly.final UIForSlider
<S> withMinorTickSpacing
(int spacing) Sets the minor tick spacing of the slider.final UIForSlider
<S> withMinorTickSpacing
(sprouts.Val<Integer> spacing) Dynamically sets the minor tick spacing of the slider.final UIForSlider
<S> withOrientation
(sprouts.Val<UI.Align> align) Dynamically sets the orientation of the slider.final UIForSlider
<S> withOrientation
(UI.Align align) Sets the orientation of the slider.final UIForSlider
<S> withValue
(int value) Sets the current value of the slider.final UIForSlider
<S> Binds the suppliedVal
property to the value of the slider, which causes the knob of the slider to move when the value of the property changes.final UIForSlider
<S> Use this to bind the suppliedVar
property to the value of the slider.Methods inherited from class swingtree.UIForAnySwing
_addComponentTo, _addViewableProps, _addViewableProps, _isUndefinedColor, _isUndefinedFont, _setBackground, _setEnabled, _setMinHeight, _setMinWidth, _setPrefWidth, add, add, add, add, add, add, add, add, add, add, addAll, addAll, addAll, addAll, addAll, addAll, doUpdates, group, group, id, id, isEnabledIf, isEnabledIf, isEnabledIf, isEnabledIfNot, isEnabledIfNot, isEnabledIfNot, isFocusableIf, isFocusableIf, isFocusableIf, isFocusableIfNot, isFocusableIfNot, isFocusableIfNot, isValidIf, isVisibleIf, isVisibleIf, isVisibleIf, isVisibleIfNot, isVisibleIfNot, isVisibleIfNot, makeFocused, makeNonOpaque, makeOpaque, on, on, onCharTyped, onFocusGain, onFocusLoss, onHidden, onKeyPress, onKeyRelease, onKeyTyped, onMouseClick, onMouseDrag, onMouseEnter, onMouseEnter, onMouseEnterGreedy, onMouseExit, onMouseExit, onMouseExitGreedy, onMouseMove, onMousePress, onMouseRelease, onMouseWheelDown, onMouseWheelMove, onMouseWheelUp, onMoved, onPressed, onRelease, onResize, onShown, onTyped, onTyped, onView, withBackground, withBackground, withBackgroundColor, withBackgroundIf, withBackgroundIf, withBackgroundIf, withBackgroundIf, withBorder, withBorder, withBorderTitled, withBorderTitled, withBoxLayout, withCompoundBorder, withCompoundBorderTitled, withCursor, withCursor, withCursorIf, withCursorIf, withDragAway, withDropSite, withEmptyBorder, withEmptyBorder, withEmptyBorder, withEmptyBorder, withEmptyBorderTitled, withEmptyBorderTitled, withEmptyBorderTitled, withEmptyBorderTitled, withEmptyBorderTitled, withEmptyBorderTitled, withEmptyBorderTitled, withEmptyBorderTitled, withFlowLayout, withFlowLayout, withFlowLayout, withForeground, withForeground, withForegroundColor, withForegroundIf, withForegroundIf, withForegroundIf, withForegroundIf, withGridBagLayout, withGridLayout, withGridLayout, withGridLayout, withHeight, withHeight, withHeightExactly, withHeightExactly, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLayout, withLineBorder, withLineBorder, withLineBorder, withLineBorderTitled, withLineBorderTitled, withLineBorderTitled, withLineBorderTitled, withMatteBorder, withMatteBorder, withMatteBorder, withMatteBorderTitled, withMatteBorderTitled, withMatteBorderTitled, withMaxHeight, withMaxHeight, withMaxSize, withMaxSize, withMaxSize, withMaxSize, withMaxSize, withMaxWidth, withMaxWidth, withMinHeight, withMinHeight, withMinSize, withMinSize, withMinSize, withMinSize, withMinSize, withMinWidth, withMinWidth, withPrefHeight, withPrefHeight, withPrefSize, withPrefSize, withPrefSize, withPrefSize, withPrefSize, withPrefWidth, withPrefWidth, withProperty, withRepaintOn, withRepaintOn, withRepaintOn, withRepaintOn, withRepaintOn, withRepaintOn, withRoundedLineBorder, withRoundedLineBorder, withRoundedLineBorder, withRoundedLineBorder, withRoundedLineBorderTitled, withRoundedLineBorderTitled, withRoundedLineBorderTitled, withRoundedLineBorderTitled, withRoundedLineBorderTitled, withRoundedLineBorderTitled, withRoundedLineBorderTitled, withSize, withSize, withSize, withSize, withSizeExactly, withSizeExactly, withSizeExactly, withSizeExactly, withStyle, withTooltip, withTooltip, withTransitionalStyle, withTransitoryStyle, withWidth, withWidth, withWidthExactly, withWidthExactly
Methods inherited from class swingtree.UIForAnything
_addBuildersTo, _addBuilderTo, _addComponentsTo, _disposeState, _onShow, _onShow, _runInApp, _runInApp, _runInUI, _this, _with, _withOnShow, _withOnShow, add, add, add, add, apply, applyIf, applyIfPresent, component, equals, get, getComponent, getType, hashCode, peek, toString
-
Method Details
-
_state
Description copied from class:UIForAnything
Returns the state of the builder, which is a container for the wrapped component as well as it's type and currentEventProcessor
.- Specified by:
_state
in classUIForAnything<UIForSlider<S extends JSlider>,
S extends JSlider, JComponent> - Returns:
- The state of the builder.
-
_newBuilderWithState
Description copied from class:UIForAnything
An internal wither method which creates a new builder instance with the providedBuilderState
stored inside it.- Specified by:
_newBuilderWithState
in classUIForAnything<UIForSlider<S extends JSlider>,
S extends JSlider, JComponent> - Parameters:
newState
- The new state which should be stored inside the new builder instance.- Returns:
- A new builder instance with the provided state stored inside it.
-
withOrientation
Sets the orientation of the slider.- Parameters:
align
- The orientation of the slider.- Returns:
- This builder node.
-
withOrientation
Dynamically sets the orientation of the slider.- Parameters:
align
- The orientation of the slider.- Returns:
- This builder node.
-
onChange
Adds anAction
to the underlyingJSlider
through anChangeListener
, which will be called when the state of the slider changes. For more information seeJSlider.addChangeListener(javax.swing.event.ChangeListener)
.- Parameters:
action
- TheAction
that will be called through the underlying change event.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifaction
isnull
.
-
withMin
Sets the minimum value of the slider. For more information seeJSlider.setMinimum(int)
.- Parameters:
min
- The minimum value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
-
withMin
Binds the suppliedVal
property to the min value of the slider so that when the value of the property changes, the min value of the slider will be updated accordingly. For more information about the underlying value in the component, seeJSlider.setMinimum(int)
.- Parameters:
min
- The min property used to dynamically update the min value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifmin
isnull
.
-
withMax
Sets the maximum value of the slider. For more information seeJSlider.setMaximum(int)
(int)}.- Parameters:
max
- The maximum value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
-
withMax
Binds the suppliedVal
property to the max value of the slider. When the value of the property changes, the max value of the slider will be updated accordingly. For more information about the underlying value in the component, seeJSlider.setMaximum(int)
.- Parameters:
max
- An integer property used to dynamically update the max value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifmax
isnull
.
-
withValue
Sets the current value of the slider. For more information seeJSlider.setValue(int)
.- Parameters:
value
- The current value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
-
withValue
Binds the suppliedVal
property to the value of the slider, which causes the knob of the slider to move when the value of the property changes. But note that the supplied property is a read only, so when the user updates the value of the slider, the property will not be updated. UsewithValue(Var)
if you want to bind a property bidirectionally. For more information about the underlying value in the component, seeJSlider.setValue(int)
.- Parameters:
val
- An integer property used to dynamically update the value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifvalue
isnull
.
-
withValue
Use this to bind the suppliedVar
property to the value of the slider. When the value of the slider changes, the value of theVar
will be updated and when the item of theVar
is changed as part of the application logic, the value of the slider will be updated accordingly.- Parameters:
var
- An integer property used to dynamically update the value of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifvalue
isnull
.
-
withMajorTickSpacing
Sets the major tick spacing of the slider. For more information seeJSlider.setMajorTickSpacing(int)
.- Parameters:
spacing
- The major tick spacing of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
-
withMinorTickSpacing
Sets the minor tick spacing of the slider. For more information seeJSlider.setMinorTickSpacing(int)
.- Parameters:
spacing
- The minor tick spacing of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
-
withMajorTickSpacing
Dynamically sets the major tick spacing of the slider. For more information seeJSlider.setMajorTickSpacing(int)
.- Parameters:
spacing
- The major tick spacing of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifspacing
isnull
.
-
withMinorTickSpacing
Dynamically sets the minor tick spacing of the slider. For more information seeJSlider.setMinorTickSpacing(int)
.- Parameters:
spacing
- The minor tick spacing of the slider.- Returns:
- This very instance, which enables builder-style method chaining.
- Throws:
IllegalArgumentException
- ifspacing
isnull
.
-