javafx绑定:文本绑定到两个属性

时间:2015-06-28 14:45:22

标签: java javafx

我想将Text Node的text属性绑定到两个属性,如:

Films

enter image description here

现在,当Available.income更改时,Text节点反映更新,但'now'更改时没有任何反应;

SELECT Films.id AS `Films__id`, Films.name AS `Films__name` 
FROM films Films 
INNER JOIN (SELECT Films.id AS `Films__id` FROM films Films) Films2 ON Films.id = Films2.id 
ORDER BY Films.released DESC

我该如何解决这个问题,谢谢

1 个答案:

答案 0 :(得分:5)

你可以做到

income.textProperty().bind(Bindings.createStringBinding(() -> 
    available.income.get() + " Income for " + now.getValue().getMonth(),
    available.income, now));