The main new functionality is around easy creation of dialogs.
The GenericDialogFX
helps quickly build a dialog and then read user inputs:
// Create a dialog
val dialog =
new GenericDialogFX(
title = "GenericDialogFX Demo",
header = "Fancy description can go here."
) {
// Add fields
addCheckbox("Check me out!", defaultValue = false)
addCheckbox("Check me too!", defaultValue = true)
}
// Show dialog to the user
dialog.showDialog()
// Read input provided by the user
if (dialog.wasOKed) {
val select1 = dialog.nextBoolean()
val select2 = dialog.nextBoolean()
println(s"Selection 1: $select1")
println(s"Selection 2: $select2")
} else {
println("Dialog was cancelled.")
}
The AutoDialog
class can generate dialog for case class and read user inputs into a new case class object:
case class FilterOptions(kernelSize: Int = 7,
start: Double = 3.14,
tag: String = "alpha",
debugMode: Boolean = false)
val result: Option[FilterOptions] =
new AutoDialog(FilterOptions())
.showDialog(
"AutoDialog Demo",
"Fields are auto generated from `FilterOptions` object")
println(s"Result: $result")
More details on the ScalaFX-Extras Project page.
Jarek