Progress Bar

Control that visually displays the progress of a processing task. As the task progresses towards completion, the progress bar displays the task's percentage of completion. This percentage is typically represented visually by a rectangle which starts out empty and gradually becomes filled in as the task progresses. In addition, the progress bar can display a textual representation of this percentage.

To indicate that a task of unknown length is executing, you can put a progress bar into indeterminate mode. While the bar is in indeterminate mode, it animates constantly to show that tas is being processed. As soon as you can determine the task's length and amount of the progress, you should update the progress bar's value and switch it back to determinate mode.

 To add a progress bar
  1. Drag the  Progress Bar element from the  Controls palette in the graphical editor.



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

Ignore – If selected, the progress bar 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.

Orientation – Orientation of the progress bar, either Vertical or Horizontal.  

Show progress string – If selected, the label is shown inside the progress bar. It is commonly used to display the current progress value. The progress string is defined in the edit box to the right. Type here the expression returning String value that will be shown inside the control. You can use two local variables in the expression: value (holds current progress value) and percent (holds current progress percent).
The example of progress string: percent + " percent(s) completed"

Minimum value – The minimum value of the progress bar. 

Maximum value – The maximum value of the progress bar. 

Progress value – The expression of type double that reflects the progress value. The simplest example: to make your progress bar show how the model time progresses, type time() here.

Determinated – Boolean expression determining whether the progress bar is in determinate or indeterminate mode. An indeterminate progress bar displays animation continuously indicating that an operation of unknown length is occurring.


Here you can specify the code to execute when the content of the progress bar is progressing. The current value of the progress bar is available here as  value (local variable of String type).


Background color – The control specifies the background color for the progress bar. 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.
Background color is correctly displayed under Windows with Classic appearance. However, certain operating systems do not support progress bars with user-defined background colors (Windows XP with XP-style appearance, Windows Vista with Windows Vista Basic or Windows Aero appearance). 

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 of 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 progress bar will be considered as a part of the agent's icon.


Progress bar value



double getValue()

Returns the current value of the progress bar. 

int getPercent()

Returns progress expressed as percentage (integer value from 0 to 100).

void setValue(double val)

Sets the value of the progress bar.

val - the new value

Value range



double getMin()

Returns the minimum value of the progress bar. 

double getMax()

Returns the maximum value of the progress bar. 

void setRange(double min, double max)

Sets the minimum and the maximum values of the progress bar.


min - the new minimum value
max - the new maximum value

Determinate mode



void setDeterminate
(boolean val)

Sets determinate property of progress bar, which determines whether the progress bar is in determinate or indeterminate mode. An indeterminate progress bar continuously displays animation indicating that an operation of unknown length is occurring. By default, this property is true.

val - if true, sets the progress bar to determinate mode, if false - to indeterminate

Progress string



void setProgressString
(String val)

Sets the String value of the progress bar.

val - the new value or null to hide progress string

Control position



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 control.

x - the new value of X coordinate

void setY(double y)

Sets the Y coordinate of the control.

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

Control size



double getWidth()

Returns the width of the control, in pixels.

double getHeight()

Returns the height of the control, in pixels.

void setWidth(double width)

Sets the width of the control equal to width.

void setHeight(double height)

Sets the height of the control equal to height.

Control visibility



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

 API Reference: ShapeProgressBar Class