09.04.2018 Views

tornadofx-guide

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4. Basic Controls<br />

button("Commit") {<br />

}<br />

tooltip("Writes input to the database")<br />

Figure 4.25<br />

Like most other builders, you can provide a closure to customize the Tooltip itself.<br />

button("Commit") {<br />

tooltip("Writes input to the database") {<br />

font = Font.font("Verdana")<br />

}<br />

}<br />

Shortcuts and Key Combinations<br />

You can fire actions when certain key combinations are typed. This is done with the<br />

shortcut function:<br />

shortcut(KeyCombination.valueOf("Ctrl+Y")) {<br />

}<br />

doSomething()<br />

There is also a string version of the shortcut function that does the same but is less<br />

verbose:<br />

shortcut("Ctrl+Y")) {<br />

}<br />

doSomething()<br />

You can also add shortcuts to button actions directly:<br />

49

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

Saved successfully!

Ooh no, something went wrong!