class MyView: View() { override val root = BorderPane() init { with(root) { center { button("Press Me") { style { fontWeight = FontWeight.EXTRA_BOLD borderColor = CssBox( top = Color.RED, right = Color.DARKGREEN, left = Color.ORANGE, bottom = Color.PURPLE ) rotate = AngularDimension(45.0, AngularDimension.Units.deg) } val switch = AtomicBoolean(true) setOnAction { style { textFill = if (switch.get().apply { switch.set(!this) }) Color.RED else Color.BLACK } } } } } } }