{
return;
}
- else if (newY > -1)
+ if (newY > -1)
{
/*
* limit page up/down to one width's worth of positions
*/
int rowSize = vpRanges.getViewportWidth();
int newX = newY > oldY ? oldX + rowSize : oldX - rowSize;
- vpRanges.setViewportStartAndWidth(newX, rowSize);
+ vpRanges.setViewportStartAndWidth(Math.max(0, newX), rowSize);
}
}
else
private void setScrollingForWrappedPanel(int topLeftColumn)
{
int scrollPosition = vpRanges.getWrappedScrollPosition(topLeftColumn);
- int maxScroll = vpRanges.getWrappedScrollPosition(vpRanges
- .getVisibleAlignmentWidth() - 1);
+ int maxScroll = vpRanges.getWrappedMaxScroll(topLeftColumn);
+ /*
+ * a scrollbar's value can be set to at most (maximum-extent)
+ * so we add extent (1) to the maxScroll value
+ */
vscroll.setUnitIncrement(1);
- vscroll.setValues(scrollPosition, 1, 0, maxScroll);
+ vscroll.setValues(scrollPosition, 1, 0, maxScroll + 1);
}
protected Panel sequenceHolderPanel = new Panel();