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

JavaFX TreeTableView slow scroll performance

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      OS X El Capitan 10.11.6

      A DESCRIPTION OF THE PROBLEM :
      TreeTableView seems to suffer from very slow scroll performance.
      In my test program I create 8000 TreeItems. When you try and scroll, the scroll bar lags behind the mouse almost as if it's attached by a rubber band.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached example and scroll.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Scroll bar should follow closely the movement of the mouse.
      ACTUAL -
      Scroll bar lags the mouse almost as if its attached by a rubber band.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Random;

      import javafx.application.Application;
      import javafx.beans.property.ReadOnlyStringWrapper;
      import javafx.scene.Scene;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeTableColumn;
      import javafx.scene.control.TreeTableColumn.CellDataFeatures;
      import javafx.scene.control.TreeTableView;
      import javafx.stage.Stage;

      public class SlowTreeTableViewScroll extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override public void start(Stage stage) {
              TreeItem<String> root = new TreeItem<>("Root");
              TreeTableView<String> treeTableView = new TreeTableView<>(root);
              treeTableView.setFixedCellSize(24);
              treeTableView.setPrefWidth(800);
              treeTableView.setPrefHeight(500);

              Scene scene = new Scene(treeTableView);
              stage.setTitle("Tree Table View Sample");
              stage.setWidth(800);
              stage.setHeight(500);

              for (int i=0 ; i < 100; ++i) {
                  TreeItem<String> child = addNodes(root);
                  child = addNodes(child);
                  child = addNodes(child);
                  child = addNodes(child);
              }

              TreeTableColumn<String, String> column = new TreeTableColumn<>("Column");
              column.setPrefWidth(150);
              column.setCellValueFactory((CellDataFeatures<String, String> p) -> new ReadOnlyStringWrapper(p.getValue().getValue()));
              treeTableView.getColumns().add(column);

              final Random rand = new Random();
              for (int i=0 ; i < 100; ++i) {
                  TreeTableColumn<String, String> col = new TreeTableColumn<>(Integer.toString(i));
                  col.setPrefWidth(25);
                  col.setCellValueFactory(val -> new ReadOnlyStringWrapper(Integer.toString(rand.nextInt(100))));
                  treeTableView.getColumns().add(col);
              }

              stage.setScene(scene);
              stage.show();
          }

          private TreeItem<String> addNodes(final TreeItem<String> parent) {
              parent.setExpanded(true);
              TreeItem<String> root = new TreeItem<>("dir");
              root.setExpanded(true);

              parent.getChildren().add(root);

              for (int i = 0; i < 20; ++i) {
                  TreeItem<String> childNode = new TreeItem<>("Node " + Integer.toString(i));
                  root.getChildren().add(childNode);
              }
              return root;
          }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: