Package com.anylogic.engine.presentation
- Nested Class Summary
- Nested classes/interfaces inherited from class com.anylogic.engine.presentation.ShapeControl
- Field Summary
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.presentation.ShapeInputControl
- Methods inherited from class com.anylogic.engine.presentation.ShapeControl
- Methods inherited from class com.anylogic.engine.presentation.Shape
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Field Details
- Constructor Details
- Method Details
- java.lang.Object
- com.anylogic.engine.presentation.Shape
- com.anylogic.engine.presentation.ShapeControl
- com.anylogic.engine.presentation.ShapeInputControl
- com.anylogic.engine.presentation.ShapeSlider
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,UsdElement
,Serializable
,Cloneable
public class ShapeSlider extends ShapeInputControl
Slider control. Embeds JSlider.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Field | Description |
---|---|---|
double | value |
The current value of the slider that can be accessed in the overridden
action() method.
Use getValue() to obtain the current slider value from
other places |
Constructor | Description |
---|---|
ShapeSlider |
Creates a persistent slider control.
|
ShapeSlider |
Deprecated.
|
ShapeSlider |
Deprecated.
may be removed in future releases
|
ShapeSlider |
Deprecated.
may be removed in future releases
|
Modifier and Type | Method | Description |
---|---|---|
void | executeUserAction |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
int | getIntValue() |
Returns the current
int value of the slider.This method may only be used in sliders with value type ShapeControl.TYPE_INT |
double | getMax() |
Returns the maximum value of the slider.
|
double | getMin() |
Returns the minimum value of the slider.
|
double | getStep() |
Returns the step of the slider.
|
double | getValue() |
Returns the current value of the slider.
|
void | setRange |
Sets the minimum and maximum values of the slider.
Doesn't execute user action code If slider is configured to work with int values (see ShapeControl.TYPE_INT ),
the given [min, max] range may be automatically corrected to have
integer bounds (within the given double bounds)This method does nothing if the slider already has such range |
void | setRange |
Sets the minimum and maximum values of the slider.
If the slider value appears out of range or not on the new step grid, it is brought within range and snapped to the grid. |
void | setStep |
Sets the step of the slider.
|
void | setStep |
Sets the step of the slider.
|
void | setValue |
Sets the value of the slider.
|
void | setValue |
Sets the value of the slider.
If the value is out of range or not on the step grid (if any), sets the closest valid value. |
action, clone, contains, executeAction, getHeight, getPresentable, getWidth, isEnabled, randomPointInside, restoreOwner, setEnabled, setHeight, setValueToDefault, setWidth
canHandleClick, findSVGElement, getDrawMode, getGroup, getLevel, getName, getOrGenerateUSDId, getRotation, getScaleX, getScaleY, getSVGId, getUsdVersion, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, isVisibleCurrently, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, setChangedUsdVersion, setLevel, setNextChangedUsdVersion, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
@AnyLogicInternalAPI public double value
The current value of the slider that can be accessed in the overridden
action() method.
Use
Use
getValue()
to obtain the current slider value from
other places@Deprecated public ShapeSlider(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, boolean vertical, double min, double max, ShapeControl.ValueType valueType)
Deprecated.
may be removed in future releases
@Deprecated public ShapeSlider(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, boolean enabled, boolean vertical, double min, double max, ShapeControl.ValueType valueType)
Deprecated.
may be removed in future releases
public ShapeSlider(Presentable p, boolean ispublic, double x, double y, double width, double height, boolean enabled, boolean vertical, double min, double max, double step, ShapeControl.ValueType valueType)
Creates a persistent slider control. You should override the action()
method.
- Parameters:
p
- the presentable object owning this controlispublic
- iftrue
, the control is visible on container's presentationx
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the heightenabled
- the initial enabled statevertical
- iftrue
- vertical, otherwise horizontalmin
- the minimum value of the slidermax
- the maximum value of the sliderstep
- the step of the slider, use0
to disable stepsvalueType
- the type of the value edited in the slider, supported types:ShapeControl.TYPE_DOUBLE
,ShapeControl.TYPE_INT
@Deprecated public ShapeSlider(Presentable p, boolean ispublic, double x, double y, double width, double height, boolean enabled, boolean vertical, double min, double max, ShapeControl.ValueType valueType)
Deprecated.
public void setValue(double val)
Sets the value of the slider.
If the value is out of range or not on the step grid (if any),
sets the closest valid value. If the value is
Doesn't execute user action code
NaN
,
sets the default value.Doesn't execute user action code
- Parameters:
val
- the new value
public void setValue(double val, boolean callAction)
Sets the value of the slider.
If the value is out of range or not on the step grid (if any), sets the closest valid value. If the value is
Executes user action code (if any exists) if
If the value is out of range or not on the step grid (if any), sets the closest valid value. If the value is
NaN
,
sets the default value.Executes user action code (if any exists) if
callAction
parameter is true
; action is executed in the same thread.- Parameters:
val
- the new valuecallAction
- iftrue
user action code (if any exists) will be executed
public double getValue()
Returns the current value of the slider.
- Returns:
- the current value of the slider
public int getIntValue()
Returns the current
This method may only be used in sliders with value type
int
value of the slider.This method may only be used in sliders with value type
ShapeControl.TYPE_INT
- Returns:
- the current
int
value of the slider
public void setRange(double min, double max)
Sets the minimum and maximum values of the slider.
Doesn't execute user action code
If slider is configured to work with int values (see
This method does nothing if the slider already has such range
Doesn't execute user action code
If slider is configured to work with int values (see
ShapeControl.TYPE_INT
),
the given [min, max]
range may be automatically corrected to have
integer bounds (within the given double bounds)This method does nothing if the slider already has such range
- Parameters:
min
- the new minimum valuemax
- the new maximum value
public void setRange(double min, double max, boolean callAction)
Sets the minimum and maximum values of the slider.
If the slider value appears out of range or not on the new step grid, it is brought within range and snapped to the grid. If current slider value changes, executes user action code (if any exists) in the same thread - if
If slider is configured to work with int values (see
This method does nothing if the slider already has such range
If the slider value appears out of range or not on the new step grid, it is brought within range and snapped to the grid. If current slider value changes, executes user action code (if any exists) in the same thread - if
callAction
parameter is true
If slider is configured to work with int values (see
ShapeControl.TYPE_INT
),
the given [min, max]
range may be automatically corrected to have
integer bounds (within the given double bounds)This method does nothing if the slider already has such range
- Parameters:
min
- the new minimum valuemax
- the new maximum valuecallAction
- iftrue
user action code (if any exists) will be executed if current slider value changes
public void setStep(double step)
Sets the step of the slider. If the slider value appears not on the new step grid,
it is snapped to the new grid. The slider action is not executed in any case.
- Parameters:
step
- the step of the slider, use0
to work without any specific step
public void setStep(double step, boolean callAction)
Sets the step of the slider.
If the slider value appears not on the new step grid, it is snapped to the new grid.
If current slider value changes, executes user action code (if any exists) in the
same thread - if
callAction
parameter is true
- Parameters:
step
- the step of the slider, use0
to work without any specific stepcallAction
- iftrue
user action code (if any exists) will be executed if current slider value changes
public double getMin()
Returns the minimum value of the slider.
- Returns:
- the minimum value of the slider
public double getMax()
Returns the maximum value of the slider.
- Returns:
- the maximum value of the slider
public double getStep()
Returns the step of the slider.
- Returns:
- the step of the slider, or
0
when slider works without any specific step (default behavior)
@AnyLogicInternalAPI public void executeUserAction(String value)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
executeUserAction
in interfaceSVGElement
- Overrides:
executeUserAction
in classShape