Number (SpinnerNumberModel model, int steps) { final int newValue = ((Number)model.getValue()).intValue() + model.getStepSize().intValue() * steps; Comparable minimum = model.getMinimum(); Comparable maximum = model.getMaximum(); if (minimum instanceof Number && minimum.compareTo(newValue) > 0) return (Number)minimum; if (maximum instanceof Number && maximum.compareTo(newValue) < 0) return (Number)maximum; return newValue; }