JavaFX: storing a null value in SimpleIntegerProperty

I have SimpleIntegerPropertyone that should be able to store null. However, this is not possible, as written in the JavaDoc IntegerProperty :

Note: setting or binding this property to a value nullsets the property to "0.0". See setValue(java.lang.Number).

This also applies to the other properties, such as LongProperty, FloatProperty, DoublePropertyand BooleanProperty(but not StringProperty, allowing null!). Why is this so? Is there a workaround nullin these properties?

+4
source share
1 answer

IntegerProperty.setValue(java.lang.Number) WriteableIntegerValue WriteableValue. JavaDoc WriteableIntegerValue, :

. null, , "0".

IntegerPropertyBase, , int ( null). API JavaFX SimpleIntegerProperty:

, int.

: , SimpleObjectProperty<Integer> SimpleIntegerProperty, SimpleObjectProperty null

+4

Source: https://habr.com/ru/post/1669382/


All Articles