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

call scrollTo on every insert results in poor performance

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows / Java 18

      A DESCRIPTION OF THE PROBLEM :
      In JavaFX 8 the scrollbar of a ListView could be "pinned/dragged" to the bottom of the ListView so when new items were put into the List it scrolls automatically to the lastindex position visible. Means autoscroll. I ported my application to JavaFX 20 and the behaviour changed - the scrollbar does not stick/pin anymore so a workaround would be to call scrollTo on every insert which results in poor performance. The call scrollTo was not needed in JavaFX 8 it provides best performance also on hundreds of thousands of inserts...


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      From a Task fill the List assigned to the Listview:
      try (InputStreamReader reader = (new InputStreamReader(input))) {
      LineIterator it = IOUtils.lineIterator(reader);
             while (it.hasNext()) {
              final String s = it.next();
              Platform.runLater(() -> {list.getItems().add(s););}
             }
      Before drag the scrollbar to the bottom of the List

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Autoscroll will happen until you touch the scrollbar to othe direction
      ACTUAL -
      The List grows and the scrollbar raise/moves in upper direction as the List is beeing filled.

      FREQUENCY : always


            jvos Johan Vos
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: