The control that is commonly used to enable a user to interactively influence the model. You can define a specific action (in the button's Action property) that will be performed every time the user clicks the button at the model runtime.
Simple demo model: Buttons Change Parameter Value
To add a button
Name – The name of the button. It is used to identify and access the control from code.
Ignore – If selected, the button will be excluded from the model.
Visible on upper agent – If selected, the control will be also visible on the upper agent where this agent lives.
Label – Here you can specify the text of the label displayed on the button.Enabled – Here you can specify Boolean expression determining whether the button is enabled or disabled.
Here you can type the code to execute when the button is pressed.
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 some 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.
Level – Level to which this control belongs.
X – X-coordinate of the button's upper left corner.
Y – Y-coordinate of the button's upper left corner.
Width – The width of the button (in pixels).
Height
– The height of the button (in pixels).
Visible – The control's visibility. The control is visible when the specified expression evaluates to true, otherwise it is 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 button's name will be displayed on the presentation diagram.
Icon – If selected, the button will be considered as a part of the agent's icon.
Function |
Description |
boolean isEnabled() |
Tests if the button is enabled or disabled. Returns true if enabled, otherwise false. |
void setEnabled |
Sets the control enabled or disabled.
Parameter: |
Function |
Description |
void action() |
Executes the action associated with the button. |
Function |
Description |
String getText() |
Returns the button label text.
|
void setText(Object text) |
Sets the button label text.
Parameter: |
Function |
Description |
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 button.
|
void setY(double y) |
Sets the Y coordinate of the button.
|
void setPos(double x,
|
Sets new coordinates for the control.
Parameters: |
Function |
Description |
double getWidth() |
Returns the width of the button in pixels. |
double getHeight() |
Returns the height of the button in pixels. |
void setWidth(double width) |
Sets the width of the button equal to width. |
void setHeight(double height) |
Sets the height of the button equal to height. |
Function |
Description |
boolean isVisible() |
Returns the visibility of the button. |
void setVisible(boolean v) |
Sets the visibility of the button. Parameter: v - visibility: if true - the button is set to be visible, if false - not visible. |