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

[TreeView] Incorrect size of ScrollBar.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • jdk 1.8.0-ea-b58

      To reproduce:

      Test case 1.

      1. Expand ROOT;
      2. Expand Item 3;
      3. Expand Item 2;
      4. Expand Item 1;

      Notice that the part of TreeView has disappeared from the viewable area, but the ScrollBar hasn't appeared yet.

      5. Expand Item 0;

      ScrollBar appears, but it's impossible to scroll to the end of TreeView, because part of the ScrollBar is not on the viewable area.

      Test case 2.

      1. Expand ROOT.
      2. Expand Item 0, 1, 2.
      3. No scroll has appeared and it is impossible to reach hidden tree items.

      package test.example;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.SelectionMode;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeView;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class TreeViewFocus extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              
              HBox root = new HBox(10d);
              
              TreeView<String> treeView = new TreeView<>();
              treeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
              
              TreeItem rootItem = new TreeItem("ROOT");
              treeView.setRoot(rootItem);
              
              for (int i = 0; i < 4; i++) {
                  TreeItem parent = new TreeItem("Item " + i);
                  rootItem.getChildren().add(parent);
                  
                  for (int j = 0; j < 4; j++) {
                      TreeItem childItem = new TreeItem("Item " + i + " " + j);
                      parent.getChildren().add(childItem);
                  }
              }
              
              root.getChildren().add(treeView);
              
              Scene scene = new Scene(root, 600, 300);
              stage.setScene(scene);
              stage.show();
          }

      }

            jgiles Jonathan Giles
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: