SinelaboreRT Header Logo


As simple as possible, but not any simpler!

User Tools

Site Tools


Generating Java Code

To generate Java code call the code generator with the command line flag ’-l java’. The generator generates just one Java class which implements the complete state machine. This has the benefit that your Java project does not become bloated with all kinds of helper classes. If required an optional base class can be specified in the config file. Also the package (Namespace=…) can be defined there. The events that can be sent to the machine are defined in a public enumeration.

The following example shows how to use the generated code together with a GUI class based on a simple SWING application. Each time a button is pressed an event is sent to the state machine. Which then writes entry/exit code of the current state to the text window.

Class serves as bridge between the java GUI code and the generated state machine code.

The state machine that realises the behaviour of the button presses looks as follows:

The complete project file for Apache Netbeans can be downloaded here.

More information is available in the manual in section “Generating Java Code”.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
wiki/backends/java_lang.txt · Last modified: 2024/05/03 22:42 by webmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki