Default value of Spinner editable property
Kevin Rushforth
kevin.rushforth at oracle.com
Sat Oct 17 14:21:13 UTC 2020
Yes, this looks like a bug. Would you mind filing it? We could add an
"@defaultValue false" to the property docs as well. The class docs do
indicate false (as you noted), but the property docs are silent on the
default value.
It looks like the only reason it hasn't caused problems for us is that
the Spinner constructor calls editableProperty() which initializes the
editable field (so the incorrect default value is not used). Still, it
would be good to fix this, since it is a bug waiting to happen if that
initialization were to ever change.
-- Kevin
On 10/16/2020 5:06 AM, Nir Lisker wrote:
> I noticed now that the class docs specify that the default is false.
> Should isEditable() be changed to return false on a null property?
>
> On Fri, Oct 16, 2020 at 2:59 PM Nir Lisker <nlisker at gmail.com> wrote:
>
>> Hi,
>>
>> Spinner's editable property seems to have conflicting initial values.
>> isEditable() returns true on an uninitialized property, but initializing it
>> sets its default to false:
>>
>> private BooleanProperty editable;
>> public final void setEditable(boolean value) {
>> editableProperty().set(value);
>> }
>> public final boolean isEditable() {
>> return editable == null ? true : editable.get(); // <---- true
>> }
>> public final BooleanProperty editableProperty() {
>> if (editable == null) {
>> editable = new SimpleBooleanProperty(this, "editable", false);
>> // <---- false
>> }
>> return editable;
>> }
>>
>> Seeme like a bug. What is the correct default?
>>
>> - Nir
>>
More information about the openjfx-dev
mailing list