Forms

TornadoFX comes with Form control to deal with handling a large number of user inputs; having several input fields to take information from the user such as login or register is common.

You can create a form with any number of fields using the form builder. Creating a form is similar to creating the View, except the parent is the form layout.

In the following code, we show a form that is used to get the input word from the user and a button to get the meaning from the web:

    form {      fieldset(labelPosition = Orientation.VERTICAL) {        field("Enter word", Orientation.VERTICAL) {          inputWord = textfield()        }        buttonbar {          button("Get meaning") {            action {              // Click event            }          }        }      }    }

Each field represents a container with the label and another container ...

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.