AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, Serializable, Cloneable

public class ShapeCheckBox
extends ShapeInputControl
Checkbox control. Embeds JCheckBox.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class com.anylogic.engine.presentation.ShapeControl

ShapeControl.ValueType

Field Summary

Modifier and TypeFieldDescription
booleanvalue
The current state of the check box (true means selected) that can be accessed in the overridden action() method.
Use isSelected() to obtain the current check box state from other places

Fields inherited from class com.anylogic.engine.presentation.ShapeControl

TYPE_DOUBLE, TYPE_INT, TYPE_STRING

Fields inherited from class com.anylogic.engine.presentation.Shape

UNKNOWN_NAME

Constructor Summary

ConstructorDescription
ShapeCheckBox(Presentable p, boolean ispublic, double x, double y, double width, double height, Color textColor, boolean enabled, Font font, String text)
Creates a persistent checkbox control.
ShapeCheckBox(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, Color textColor, boolean enabled, Font font, String text)
Deprecated.
may be removed in future releases
ShapeCheckBox(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, Color textColor, Font font, String text)
Deprecated.
may be removed in future releases

Method Summary

Modifier and TypeMethodDescription
voidexecuteUserAction(String value)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
StringgetText()
Returns the checkbox label text.
booleanisSelected()
Returns the selected state of the checkbox.
voidsetSelected(boolean yes)
Sets the selected state of a persistent checkbox
Doesn't execute user action code
voidsetSelected(boolean yes, boolean callAction)
Sets the selected state of a persistent checkbox
Executes user action code (if any exists) if callAction parameter is true
voidsetText(Object text)
Sets the checkbox label text

Methods inherited from class com.anylogic.engine.presentation.ShapeInputControl

postSVGShapeSpecificAttributes

Methods inherited from class com.anylogic.engine.presentation.ShapeControl

action, clone, contains, executeAction, getHeight, getPresentable, getWidth, isEnabled, randomPointInside, restoreOwner, setEnabled, setHeight, setValueToDefault, setWidth

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, postInitialize

Field Details

value

@AnyLogicInternalAPI
public boolean value
The current state of the check box (true means selected) that can be accessed in the overridden action() method.
Use isSelected() to obtain the current check box state from other places

Constructor Details

ShapeCheckBox

@Deprecated
public ShapeCheckBox(Presentable p,
 boolean ispublic,
 double x,
 double y,
 double width,
 double height,
 Color backgroundColor,
 Color textColor,
 Font font,
 String text)
Deprecated.
may be removed in future releases

ShapeCheckBox

@Deprecated
public ShapeCheckBox(Presentable p,
 boolean ispublic,
 double x,
 double y,
 double width,
 double height,
 Color backgroundColor,
 Color textColor,
 boolean enabled,
 Font font,
 String text)
Deprecated.
may be removed in future releases

ShapeCheckBox

public ShapeCheckBox(Presentable p,
 boolean ispublic,
 double x,
 double y,
 double width,
 double height,
 Color textColor,
 boolean enabled,
 Font font,
 String text)
Creates a persistent checkbox control. You should override the action() method.
Parameters:
p - the presentable object owning this control
ispublic - if true, the control is visible on container's presentation
x - the x coordinate
y - the y coordinate
width - the width
height - the height
textColor - the text color
enabled - the initial enabled state
font - the text font
text - the text label of the control

Method Details

setSelected

public void setSelected(boolean yes)
Sets the selected state of a persistent checkbox
Doesn't execute user action code
Parameters:
yes - if true - selected, otherwise - not

setSelected

public void setSelected(boolean yes,
 boolean callAction)
Sets the selected state of a persistent checkbox
Executes user action code (if any exists) if callAction parameter is true
Parameters:
yes - if true - selected, otherwise - not
callAction - if true user action code (if any exists) will be executed

isSelected

public boolean isSelected()
Returns the selected state of the checkbox.
Returns:
true if selected, false if not

setText

public void setText(Object text)
Sets the checkbox label text
Parameters:
text - the new checkbox text

getText

public String getText()
Returns the checkbox label text.
Returns:
the checkbox label text

executeUserAction

@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.
Specified by:
executeUserAction in interface SVGElement
Overrides:
executeUserAction in class Shape