void (boolean reversed) { int delta = myScrollBar.getBlockIncrement(reversed ? -1 : 1); if (reversed) delta = -delta; int oldValue = myScrollBar.getValue(); int newValue = oldValue + delta; if (delta > 0 && newValue < oldValue) { newValue = myScrollBar.getMaximum(); } else if (delta < 0 && newValue > oldValue) { newValue = myScrollBar.getMinimum(); } if (oldValue != newValue) { myScrollBar.setValue(newValue); } }