java - String property bound to binary property -
i wish set title of javafx togglebutton depending of state:
imperative java code:
tgbtn.settext( tgbtn.isselected() ? "stop" : "start" );
i wish use javafx bindings miss "ternary" operator:
tgbtn.textproperty().bind( tgbtn.selectedproperty().asstring());
with binding text of button becomes:
can suggest binding display "start" / "stop"?
tgbtn.textproperty().bind( bindings.when(tgbtn.selectedproperty()) .then("stop") .otherwise("start") );
Comments
Post a Comment