Default value of Spinner editable property

Nir Lisker nlisker at gmail.com
Fri Oct 16 12:06:53 UTC 2020


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