void (MouseWheelEvent e) { if (e.getUnitsToScroll() == 0) return; JTextField field = getTextField(); final SpinnerNumberModel model = getNumberModel(); if (field.hasFocus() && isEnabled()) { model.setValue(calculateNewValue(model, e.getUnitsToScroll())); } }