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: when released when pressed

can suggest binding display "start" / "stop"?

tgbtn.textproperty().bind(    bindings.when(tgbtn.selectedproperty())      .then("stop")      .otherwise("start") ); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -