【发布时间】:2016-04-02 04:17:15
【问题描述】:
给定一个BooleanBinding 类型的Java 表达式(比如x.lessThan(y)),使用来自boolean 的自定义映射将ObjectProperty p 绑定到它的最简单方法是什么?
具体来说,有没有比以下更简单的方法?
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;
}
}
});
我很想做类似p.bind(x.lessThan(y).ifElse(Color.BLUE,Color.RED))的事情
【问题讨论】:
标签: java data-binding javafx javafx-8