Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8116452

ListView scroll bar thumb resizes wildly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 7u6
    • javafx

      If you have a list view with wildly different cell heights, including some where a single cell fills the entire viewport, then as you scroll the thumb goes wild, sometimes being tiny, sometimes being very large. The thumb shouldn't change size ever, only the speed at which it travels when using pixel scrolling / up/down arrows.

      Proposed Fix:


      diff -r a84b7d37f507 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java
      --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java Mon Sep 17 15:44:47 2012 -0700
      +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java Tue Sep 18 10:28:05 2012 -0700
      @@ -26,19 +26,16 @@
       package com.sun.javafx.scene.control.skin;
       
       import java.util.ArrayList;
      -
       import javafx.beans.InvalidationListener;
       import javafx.beans.Observable;
       import javafx.beans.property.BooleanProperty;
       import javafx.beans.property.BooleanPropertyBase;
      -import javafx.beans.property.DoubleProperty;
      -import javafx.beans.property.DoublePropertyBase;
       import javafx.beans.value.ChangeListener;
       import javafx.beans.value.ObservableValue;
       import javafx.collections.ObservableList;
       import javafx.event.Event;
      +import javafx.event.EventDispatchChain;
       import javafx.event.EventDispatcher;
      -import javafx.event.EventDispatchChain;
       import javafx.event.EventHandler;
       import javafx.geometry.Orientation;
       import javafx.scene.Group;
      @@ -52,7 +49,6 @@
       import javafx.scene.layout.Region;
       import javafx.scene.layout.StackPane;
       import javafx.scene.shape.Rectangle;
      -
       import javafx.util.Callback;
       
       /**
      @@ -1313,12 +1309,13 @@
       
               if (lengthBar.isVisible()) {
                   lengthBar.setMax(1);
      -
      - if (numCellsVisibleOnScreen == 0) {
      - // special case to help resolve RT-17701
      +
      + if (numCellsVisibleOnScreen == 0 && cellCount == 1) {
      + // special case to help resolve RT-17701 and the case where we have
      + // only a single row and it is bigger than the viewport
                       lengthBar.setVisibleAmount(flowLength / sumCellLength);
                   } else {
      - lengthBar.setVisibleAmount(numCellsVisibleOnScreen / (float) cellCount);
      + lengthBar.setVisibleAmount(cellCount / viewportLength);
                   }
       
                   // Fix for RT-11873. If this isn't here, we can have a situation where

            msladecek Martin Sládeček
            rbair Richard Bair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: