Let's code!
Our project is ready with the required project structure, Gradle dependency, and configuration. It's time to write the application code.Â
Application class
The Application
class is the starting point, and there must be at least one class that extends the App
class. It specifies the initial View that contains the display logic and layout of nodes that are managed as singleton:
/** * Starting point of the application */ class DictionaryApp : App(MainView::class, Styles::class)
We need to specify the primary View to the App
class as the first constructor parameter. The second Styles
parameter is optional and contains the Stylesheet
 method.
Type-safe CSS
TornadoFX provides type-safe CSS, which enables autocompletion, and checks at compilation time to conveniently create styles in its own class or provide inline styling. It's recommended to provide a Stylesheet
 method if you want to reuse and organize your styles. Take a look at the following code snippet:
class Styles...