Check Box

Сheck box is a control element that can be selected or deselected. It displays its state to the user.

Check boxes are commonly used for modifying values of boolean variables and parameters at the model runtime.

However, if your variables are of type int, we recommend to modify their values using slidersString and double variables are best controlled using edit boxes.

 To add a check box
  1. Drag the  Check Box element from the  Controls palette into the graphical editor.
  2. Navigate to the element's Properties.
  3. You can bind the chec kbox with a boolean variable or parameter (on changing the value of the chec kbox, the linked parameter/variable immediately gets this value). To link the control to a parameter, select the Link to check box and choose the name of the parameter from the drop-down list on the right. You can also easily link a control to a parameter of a flowchart block. Linking controls to parameters is thoroughly described here.
  4. You can also define any action to be executed each time the value of the chec kbox is changed. Type the code you want to execute into the Action section (the current value of the check box is available here as value (boolean variable: true, if the check box is selected, and false otherwise)). 



Name – The name of the check box. It is used to identify and access the control from code.

Ignore – If selected, the check box will be excluded from the model.

Visible on upper level – If selected, the control will be also visible on the upper level where this agent lives.

Label – Here you can specify the text of the label displayed for the check box.

Link to – If you want to bind the check box with a boolean variable or a parameter (on changing the value of the check box, the linked parameter/variable immediately gets this value), select the Link to check box and enter the name of the variable/parameter that you want to link to this control.

Default value – [Visible if the Link to check box  is not selected] Boolean expression determining whether the check box is selected or not by default. If this check box  is linked to some variable or parameter, it uses the default value of this variable/parameter as its default value.

Enabled – Here you can specify Boolean expression determining whether the check box is enabled or disabled.


Here you can type the code to execute when the check box  is clicked. The current state of the check box is available here as value (boolean variable: true, if the check box is selected, and false otherwise)


Text color – The control specifies the color of the label's text. Click inside the control and choose a color from the set of the most used ones, or choose a custom color using the Colors dialog box.

Font – Specifies the font family for the label's text. You can adjust the size of the text in the field to the right (pt.).

Italic – If selected, the label's text will be italicized.

Bold – If selected, the label's text will be emphasized in bold.

Position and size

X – X-coordinate of the control's upper left corner.

Y – Y-coordinate of the control's upper left corner.

Width – The width of the control (in pixels).

Height – The height of the control (in pixels).


Visible – The control's visibility.  The control is visible when the specified expression evaluates to true, otherwise it is and not visible.

Replication – Here you specify the number copies of this control you want to be created. If you leave this field empty, only one such control will be created.

Show name – If selected, the name of the control will be displayed on a presentation diagram.

Icon – If selected, the check box will be considered as a part of the agent's icon.


Selecting/deselecting the check box 



boolean isSelected()

Returns the state of the check box . 

Returns true if it is currently selected,  false if not,

void setSelected
(boolean yes)

Sets the state of the check box . Doesn't execute user action code,

yes - if true - selected, otherwise - not

void setSelected
(boolean yes,
boolean callAction)

Sets the selected state of the check box .
Executes user action code (if there is any) if callAction parameter is true.

yes - if true - selected, otherwise - not
callAction - if true user action code (if there is any) will be executed

void setValueToDefault()

Sets the state of the check box  that was provided as the default one.

Doesn't execute user action code.

Enabling/disabling the control



boolean isEnabled()

Tests if the control is enabled or disabled. Returns true if enabled, false otherwise.

void setEnabled
(boolean yes)

Sets the control enabled or disabled.

yes - If true, the control will be enabled, if false - disabled. 

Executing the check box action programmatically



void action()

Executes the associated with the check box  action.

Label text



String getText()

Returns the check box  label text.

void setText(Object text)

Sets the check box  label text.

Parameter: text - the new label text




double getX()

Returns the X coordinate of the control (namely, the X coordinate of its upper left corner).

double getY()

Returns the Y coordinate of the control (namely, the Y coordinate of its upper left corner).

void setX(double x)

Sets the X coordinate of the check box .

x - the new value of X coordinate

void setY(double y)

Sets the Y coordinate of the check box .

y - the new value of Y coordinate

void setPos(double x,
double y)

Sets new coordinates for the control.

x - the new value of x coordinate
y - the new value of y coordinate




boolean isVisible()

Returns the visibility of the control.

void setVisible(boolean v)

Sets the visibility of the control.

v - visibility: if true - the control is set to be visible, if false - not visible.

Related topics

 Aligning shapes

 API reference: Shapecheck box  class