Skip to content

Setting a custom StringConverter on an IntegerField can break the Spinner in SimpleIntegerControl #46

@sten-navie

Description

@sten-navie

One can set a custom StringConverter on an IntegerField via IntegerField.format(..)
The default control for IntegerField, SimpleIntegerControl is a wrapper around an Integer based spinner. Setting a custom StringConverter on the field seems to break the spinner up-down feature, as the spinner is not aware of the StringConverter on the field. Editing the field by typing into the text-field part of the spinner works as expected.

Workaround:

  • Override SimpleIntegerControl and apply the custom converter in the "initializeParts" method.
@Override
public void initializeParts() {
    super.initializeParts();
    editableSpinner.getValueFactory().setConverter(myCustomConverter);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions