Package jltk.gui
Class Slider
- java.lang.Object
-
- jltk.Component
-
- jltk.gui.Control
-
- jltk.gui.Slider
-
public class Slider extends Control
A slider ist used to select a numeric value from a continuous or discrete range. events: changed- Version:
- 19.05.2022
- Author:
- ms
-
-
Field Summary
Fields Modifier and Type Field Description protected javafx.scene.control.Slider
fxSlider
-
Fields inherited from class jltk.Component
fxNode, hasFocus, myWindow, onFocusGained, onFocusLost
-
-
Constructor Summary
Constructors Constructor Description Slider(double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue)
Creates the slider on the specified postion.Slider(double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue, double pStep)
Creates the spinner on the specified postion.Slider(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue)
Creates the spinner at the specified positionSlider(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue, double pStep)
Creates the spinner at the specified position
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decrement()
Attempts to increment the slider by one step.void
disableSnaping()
Disables "snap to tick".void
enableSnaping()
Enables "snap to tick.double
getMaxValue()
Gets the maximal value represented by this sliderdouble
getMinValue()
Gets the minimum value represented by this sliderdouble
getValueAsDouble()
Returns the current value as doubleint
getValueAsInteger()
Returns the current value as integervoid
hideTickLabels()
Hide tick labels.void
hideTickMarks()
Hide tick marks.void
increment()
Attempts to increment the slider by one step.void
setLabledTickDistance(double pDistance)
Sets the ditance between two labled ticks.void
setMaxValue(double pMax)
Sets the maximal value represented by this slidervoid
setMinValue(double pMin)
Sets the minimum value represented by this slidervoid
setOnChanged(String pMethodName)
Sets the name of the method, which will be invoked, if the slider is changedvoid
setUnlabledTickCount(int pCount)
Set the amount of unlabled ticks between two labled ticks.void
setValue(double pValue)
Sets the value of the slider to the specified value.void
showTickLabels()
Show tick labels.void
showTickMarks()
Show tick marks.-
Methods inherited from class jltk.gui.Control
getColor, getHeight, getWidth, init, setColor, setColor, setColor, setHeight, setSize, setTooltip, setWidth
-
Methods inherited from class jltk.Component
activate, deactivate, focus, getX, getY, hasFocus, hide, init, istActive, isVisible, runMethodByName, setOnFocusGained, setOnFocusLost, setPosition, show, toBack, toFront
-
-
-
-
Constructor Detail
-
Slider
public Slider(double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue)
Creates the slider on the specified postion.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the sliderpHeight
- The height of the sliderpMin
- The minimal value of the sliderpMax
- The maximal value of the sliderpStep
- The amount to step by
-
Slider
public Slider(double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue, double pStep)
Creates the spinner on the specified postion.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the spinnerpHeight
- The height of the spinnerpMin
- The minimal value of the spinnerpMax
- The maximal value of the spinnerpInitialValue
- Value shown on start.pStep
- The amount to step by
-
Slider
public Slider(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue)
Creates the spinner at the specified position- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the spinnerpHeight
- The height of the spinnerpWindow
- The window, the spinner should be placedpMin
- The minimal value of the spinnerpMax
- The maximal value of the spinnerpInitialValue
- Value shown on start.pStep
- The amount to step by
-
Slider
public Slider(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, double pMin, double pMax, double pInitialValue, double pStep)
Creates the spinner at the specified position- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the spinnerpHeight
- The height of the spinnerpWindow
- The window, the spinner should be placedpMin
- The minimal value of the spinnerpMax
- The maximal value of the spinnerpInitialValue
- Value shown on start.pStep
- The amount to step by
-
-
Method Detail
-
setOnChanged
public void setOnChanged(String pMethodName)
Sets the name of the method, which will be invoked, if the slider is changed
-
increment
public void increment()
Attempts to increment the slider by one step.
-
decrement
public void decrement()
Attempts to increment the slider by one step.
-
getValueAsInteger
public int getValueAsInteger()
Returns the current value as integer- Returns:
- the current value of the slider
-
getValueAsDouble
public double getValueAsDouble()
Returns the current value as double- Returns:
- the current value of the slider
-
setValue
public void setValue(double pValue)
Sets the value of the slider to the specified value.- Parameters:
pValue
- New value of the slider
-
showTickMarks
public void showTickMarks()
Show tick marks.
-
hideTickMarks
public void hideTickMarks()
Hide tick marks.
-
showTickLabels
public void showTickLabels()
Show tick labels.
-
hideTickLabels
public void hideTickLabels()
Hide tick labels.
-
setLabledTickDistance
public void setLabledTickDistance(double pDistance)
Sets the ditance between two labled ticks.- Parameters:
pDistance
- The distance between two labled ticks.
-
setUnlabledTickCount
public void setUnlabledTickCount(int pCount)
Set the amount of unlabled ticks between two labled ticks.- Parameters:
pCount
- The number of unlabled ticks.
-
enableSnaping
public void enableSnaping()
Enables "snap to tick. The value of the slider will be align to a tick.
-
disableSnaping
public void disableSnaping()
Disables "snap to tick". The slider can be move continously.
-
setMinValue
public void setMinValue(double pMin)
Sets the minimum value represented by this slider- Parameters:
pMin
- Slider minium value
-
setMaxValue
public void setMaxValue(double pMax)
Sets the maximal value represented by this slider- Parameters:
pMax
- Slider maximum value
-
getMinValue
public double getMinValue()
Gets the minimum value represented by this slider- Returns:
- Slider minimum value
-
getMaxValue
public double getMaxValue()
Gets the maximal value represented by this slider- Returns:
- Slider maximal value
-
-