JAL-147 corrected calculation of vertical scroll position and max
[jalview.git] / src / jalview / appletgui / AlignmentPanel.java
index edf6ad4..f8f31b2 100644 (file)
@@ -994,11 +994,14 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
   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();