FormsFX icon indicating copy to clipboard operation
FormsFX copied to clipboard

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

Open sten-navie opened this issue 5 years ago • 0 comments

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);
}

sten-navie avatar Apr 11 '19 14:04 sten-navie