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

public class ShapeRadioButtonGroup
extends ShapeInputControl
A group of radio buttons. Embeds JPanel containing a several grouped JRadioButtons. User's radio button group. Calls presentable object's executeControlAction( id, index, index of the selected button ) method when a button is selected (even if it was selected before). The orientation and the array of text labels for buttons can only be set once when the group is created.
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
intvalue
The currently selected radio button (-1 if none) that can be accessed in the overridden action() method.
Use getValue() to obtain the currently selected radio button 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
ShapeRadioButtonGroup(Presentable p, boolean ispublic, double x, double y, double width, double height, Color textColor, boolean enabled, Font font, boolean vertical, String[] texts)
Creates a persistent radio button group control.
ShapeRadioButtonGroup(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, Color textColor, boolean enabled, Font font, boolean vertical, String[] texts)
Deprecated.
may be removed in future releases
ShapeRadioButtonGroup(Presentable p, boolean ispublic, double x, double y, double width, double height, Color backgroundColor, Color textColor, Font font, boolean vertical, String[] texts)
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.
intgetValue()
Returns the currently selected radio button, -1 if none.
voidsetValue(int index)
Sets the radio button with the given index selected, makes others deselected.
Doesn't execute user action code
voidsetValue(int index, boolean callAction)
Sets the radio button with the given index selected, makes others deselected.
Executes user action code (if any exists) if callAction parameter is true

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 int value
The currently selected radio button (-1 if none) that can be accessed in the overridden action() method.
Use getValue() to obtain the currently selected radio button from other places.

Constructor Details

ShapeRadioButtonGroup

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

ShapeRadioButtonGroup

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

ShapeRadioButtonGroup

public ShapeRadioButtonGroup(Presentable p,
 boolean ispublic,
 double x,
 double y,
 double width,
 double height,
 Color textColor,
 boolean enabled,
 Font font,
 boolean vertical,
 String[] texts)
Creates a persistent radio button group 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
vertical - sets the layout of the radio buttons
texts - the array of text labels of the radio buttons

Method Details

setValue

public void setValue(int index)
Sets the radio button with the given index selected, makes others deselected.
Doesn't execute user action code
Parameters:
index - the index of the button

setValue

public void setValue(int index,
 boolean callAction)
Sets the radio button with the given index selected, makes others deselected.
Executes user action code (if any exists) if callAction parameter is true
Parameters:
index - the index of the button
callAction - if true user action code (if any exists) will be executed

getValue

public int getValue()
Returns the currently selected radio button, -1 if none.
Returns:
the currently selected radio button, -1 if none

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