如果我这样做:
BooleanProperty b = new SimpleBooleanProperty();
b.setValue(null);
System.out.println(b.getValue());
我收到输出:
false
如何将SimpleBooleanProperty
的值设置为null
?将SimpleBooleanProperty
设置为null
(BooleanProperty b = null;
)是个不好的主意,因为我会使用绑定(binding)。
我找到了方法:
ObjectProperty<Boolean> b = new SimpleObjectProperty<Boolean>(null);
System.out.println(b.getValue());
运行正常。
我无法回答自己的问题,所以把它放在这里,请见谅。
null
? - undefinedBoolean
的值设为null
,而不是boolean
。 - undefined