Printing the result

When the user clicks on Get meaning, we will need to get the input word from the input field so that we can fetch its meaning. For this reason, let's keep the instance of the input field in a global state. We also need a label to print the result when the meaning is fetched from the API. 

We will make these variables global as the actual values will be assigned later as a format known as a delegation. We can use the lateinit modifier, but TornadoFX comes with a singleAssign delegate that mimics the behavior of lateinit, but it doesn't result in a crash, and tells the compiler that the value will only be assigned once. It is also thread safe and helps mitigate issues with mutability represented by the following lines of ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.