Font size

Java editor

You can view the code AnyLogic generates for your agent classes in the Java editor.

Java editor

To open Java class in Java editor

  1. Double-click the Java class in the Projects view.

To open code of agent type in Java editor

  1. You can examine the code of the agent type only after the model was built at least once. To build the model, select any model element and click the Build model toolbar button, or press F7.
  2. Now AnyLogic have compiled code for all classes defined in the model. In the Projects view, right-click (macOS: Ctrl + click) the agent type, which code you want to view, and choose Open with > Java Editor from the popup menu.
  3. Java editor is opened.

Notice the syntax highlighting. Different kinds of elements in the Java source are rendered in unique colors. Examples of Java source elements that are rendered differently are:

  • Regular comments
  • Javadoc comments
  • Keywords
  • Strings

There is one more way of opening source code of agent type. Moreover, this approach brings you to the place of the source code, that corresponds to some particular property you are interested in.

To open source code for a property

  1. In the Properties view, click in the code property, which source code you want to examine.
  2. Press Ctrl + J (macOS: Cmd + J). This will open Java editor. The whole code snippet generated for the selected property will be selected.
How can we improve this article?