use of com.kotcrab.vis.ui.util.IntDigitsOnlyFilter in project vis-ui by kotcrab.
the class IntSpinnerModel method bind.
@Override
public void bind(Spinner spinner) {
super.bind(spinner);
VisValidatableTextField valueText = spinner.getTextField();
valueText.getValidators().clear();
valueText.addValidator(boundsValidator);
valueText.addValidator(Validators.INTEGERS);
valueText.setTextFieldFilter(textFieldFilter = new IntDigitsOnlyFilter(true));
textFieldFilter.setUseFieldCursorPosition(true);
if (min >= 0) {
textFieldFilter.setAcceptNegativeValues(false);
} else {
textFieldFilter.setAcceptNegativeValues(true);
}
spinner.notifyValueChanged(true);
}
Aggregations