You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 28, 2024. It is now read-only.
As mentioned in Type Safe Builders, Kotlin already makes JavaFX code much easier to write and reason about. However, some parts of the JavaFX API could benefit from some extra love. This section describes some of the additions TornadoFX includes to make your code more consice.
TableView and ListView
// Take action when user selects a row
table.onUserSelect {
editCustomer(it)
}
// Take action when selection changes
table.onSelectionChange {
showCustomerDetails(it)
}
// Take action when user deletes row
table.onUserDelete {
deleteCustomer(it)
}
// Add column with valueProvider
table.addColumn<Customer, String>("Name") { it.value.name }
// Get selected itemval selected = table.selectedItem
TableColumn and ListView cell
// Configure updateItem for column
column.cellFormat { customer:Customer->
text = customer.name
graphic =ImageView(customer.avatar)
}
Panes (Nodes that has children)
// replace all children
pane.replaceChildren(newComponent1, newComponent2)
// Reload stylesheets (also valid for Scene)
pane.reloadStylesheets()
Stage
// Reload stylesheets on stage focus
stage.reloadStylesheetsOnFocus()