Generating Java Code
To generate Java code call the code generator with the command line flag
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 SMBase.java serves as bridge between the java GUI code and the generated state machine code.
The complete project file for Apache Netbeans can be downloaded here.
More information is available in the manual in section “Generating Java Code”.