public void scrollByUnit(int direction) { float size; if (orientation == VERTICAL) { direction *= -1; size = scrollSpace + slider.getThumbButton().getHeight() / slider.getHeight(); } else size = scrollSpace + slider.getThumbButton().getWidth() / slider.getWidth(); if (direction == DECREMENT) setValue(getValue() - size); else setValue(getValue() + size); }