09.04.2018 Views

tornadofx-guide

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7. Layouts and Menus<br />

Awesome right? You can specify one or more controls for each of the fields, and the Form<br />

will render the groupings and labels for you.<br />

You can choose to lay out the label above the inputs as well:<br />

fieldset("FieldSet", labelPosition = VERTICAL)<br />

Each field represents a container with the label and another container for the input fields<br />

you add inside it. The input container is by default an HBox , meaning that multiple inputs<br />

within a single field will be laid out next to each other. You can specify the orientation<br />

parameter to a field to make it lay out multiple inputs below each other. Another use case for<br />

Vertical orientation is to allow an input to grow as the form expands vertically. This is handy<br />

for displaying TextAreas in Forms:<br />

form {<br />

fieldset("Feedback Form", labelPosition = VERTICAL) {<br />

field("Comment", VERTICAL) {<br />

textarea {<br />

prefRowCount = 5<br />

vgrow = Priority.ALWAYS<br />

}<br />

}<br />

buttonbar {<br />

button("Send")<br />

}<br />

}<br />

}<br />

Figure 7.8<br />

96

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!