Well, if you keep the old value since the last validation of the input, you can then reset the counter value back to the last valid value.
boolean valid = validate(spinner);
if (valid)
validValue = spinner.getValue();
else
spinner.setValue(validValue);
Maybe something like that.
source
to share