【发布时间】:2013-06-15 13:26:11
【问题描述】:
我有一个简单的文本字段。我需要将它绑定到 JodaTime DateTime 属性的静态实例。 JodaTime 给了我很多属性,但我想不出解决方案。
我需要的只是 DateTime 的实际时间,所以我假设如下:
Text clock = new Text();
clock.textProperty().bind(AppController.getSimulationClock().toLocalTime().toString());
但是,toLocalTime() 返回一个字符串。再说一次,如果我尝试:
Text clock = new Text();
clock.textProperty().bind(AppController.getSimulationClock().dayOfMonth());
作为dayOfMonth() 返回一个实际属性,它仍然不起作用。
仅作记录,AppController.getSimulationClock() 只是返回一个普通的不可变 JodaTime DateTime 对象。
Netbeans 给了我这个解释:
实参org.joda.time.DateTime.Property不能通过方法调用转换为ObservableValue 其中 T 是一个类型变量: T 扩展了接口 javafx.beans.property.Property 中声明的 Object
有什么想法吗?
【问题讨论】:
标签: java datetime data-binding javafx-2 jodatime