import javafx.application.Application import javafx.geometry.Pos import tornadofx.* fun main() = Application.launch(TestApp::class.java) class TestApp : App(TestView::class) class TestView : View("Learn") { val maxDepth = intProperty(1) val sliderr = intProperty(1) val oldValuee = intProperty(0) override val root = vbox(10) { prefHeight = 200.0 prefWidth = 250.0 alignment = Pos.CENTER label(maxDepth.stringBinding{"spinner, oldValue: ${oldValuee.value}, newValue: ${maxDepth.value}"}) spinner(1, 10, 4, 1, true, maxDepth) { minWidth = 200.0 valueProperty().addListener { _, oldValue, newValue -> oldValuee.value=oldValue.toInt() } } label(sliderr.stringBinding { "slider value: $it" }) slider(1,10,4){ maxWidth = 150.0 isShowTickLabels = true isShowTickMarks = true valueProperty().bindBidirectional(sliderr) valueProperty().addListener { _, oldValue, newValue -> println("oldValue: ${oldValue.toInt()}, newValue: ${newValue.toInt()}") } } } }