将自定义对象属性绑定到BooleanBinding

时间:2015-12-28 10:05:48

标签: java data-binding javafx javafx-8

给定类型为id的Java表达式(比如BooleanBinding),使用x.lessThan(y)的自定义映射将ObjectProperty p绑定到它的最简单方法是什么? / p>

具体来说,是否有比以下更简单的方法?

boolean

我会喜欢做BooleanBinding b = x.lessThan(y); p.bind(new ObjectBinding<Paint>(){ { super.bind(b); } @Override protected Paint computeValue() { if(b.get()){ return Color.BLUE; } else { return Color.RED; } } });

之类的事情

1 个答案:

答案 0 :(得分:3)