0
は、次の例を考えてみましょう:TornadoFXノードスタイル(またはstyleClass)をプロパティにバインドする方法は?
class MainView : View("Example") {
val someBooleanProperty: SimpleBooleanProperty = SimpleBooleanProperty(true)
override val root = borderpane {
paddingAll = 20.0
center = button("Change bg color") {
action {
// let's assume that new someBooleanProperty value is updated
// from some API after button clicked
// so changing style of the borderpane in action block
// of the button is not the solution
someBooleanProperty.value = !someBooleanProperty.value
}
}
}
}
class Styles : Stylesheet() {
companion object {
val red by cssclass()
val green by cssclass()
}
init {
red { backgroundColor += Color.RED }
green { backgroundColor += Color.GREEN }
}
}
はどのようにして動的にsomeBooleanProperty
(例えばRED true
とGREEN false
)に応じて、borderpane
の背景色を変更できますか? CSSクラスをプロパティにバインドする可能性はありますか?
完璧、たくさんありがとう! – sk1ey