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.

Workspaces<br />

It looks like a default button. You can remove the border around the button by adding the<br />

icon-only css class to it. Optionally you can configure an icon for the graphic node if you<br />

like. The built in icons are svg shapes added in the built in workspace.css but feel free to<br />

add your icon in any way you see fit. Let's add an icon from the FontAwesomeFX library and<br />

make it look like the other buttons:<br />

button("Add Customer") {<br />

addClass("icon-only")<br />

graphic = FontAwesomeIconView(PLUS_CIRCLE).apply {<br />

style {<br />

fill = c("#818181")<br />

}<br />

glyphSize = 18<br />

}<br />

action { addCustomer() }<br />

}<br />

In a real application you would use a css class so you don't need to configure the fill for<br />

every button you add. The result can be seen in Figure 16.5:<br />

Figure 16.5<br />

234

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

Saved successfully!

Ooh no, something went wrong!