class My20View : View() { override val root = BorderPane() init { with (root) { setPrefSize(400.0, 400.0) left { label("I'm left") } right { label("I'm right") } center { style { backgroundColor += Color.RED } } widthProperty().addListener { obs, old, new -> val sideWidth = new.toDouble() * 0.2 (left as Region).prefWidth = sideWidth (right as Region).prefWidth = sideWidth } } } }