else {
return;
}
}
RangeSlider rangeSlider = (RangeSlider) slider;
switch (handle) {
case MOUSE_HANDLE_MIN:
rangeSlider.setLowValue(Math.min(newValue, rangeSlider.getHighValue()));
break;
case MOUSE_HANDLE_MAX:
rangeSlider.setHighValue(Math.max(rangeSlider.getLowValue(), newValue));
break;
case MOUSE_HANDLE_MIDDLE:
if (((RangeSlider) slider).isRangeDraggable()) {
int delta = (slider.getOrientation() == JSlider.VERTICAL) ?
valueForYPosition(newLocation - handleOffset) - rangeSlider.getLowValue() :
valueForXPosition(newLocation - handleOffset) - rangeSlider.getLowValue();
if ((delta < 0) && ((rangeSlider.getLowValue() + delta) < rangeSlider.getMinimum())) {
delta = rangeSlider.getMinimum() - rangeSlider.getLowValue();
}
if ((delta > 0) && ((rangeSlider.getHighValue() + delta) > rangeSlider.getMaximum())) {
delta = rangeSlider.getMaximum() - rangeSlider.getHighValue();
}
if (delta != 0) {
rangeSlider.setLowValue(rangeSlider.getLowValue() + delta);
rangeSlider.setHighValue(rangeSlider.getHighValue() + delta);
}
}
break;
}
}