java - javafx Bindings: Text bind to two properties -


i want bind text property of text node 2 properties this:

text income = new text(); income.textproperty().bind(bindings.concat(available.income.asstring()).concat(" income ").concat(now.getvalue().getmonth().tostring())); 

enter image description here

now, when available.income changes, text node reflect update, when 'now' changes nothing happens;

public static simpleintegerproperty income = new simpleintegerproperty private objectproperty<yearmonth> = new simpleobjectproperty<yearmonth>(yearmonth.now()); 

how can solve this, thanks

you can do

income.textproperty().bind(bindings.createstringbinding(() ->      available.income.get() + " income " + now.getvalue().getmonth(),     available.income, now)); 

Comments

Popular posts from this blog

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -