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

[TreeItem|TreeCell]Graphics of TreeItem sometimes becomes invisible after collapsing any node

    Details

      Description

      I've found some strange behaviour of TreeItem's graphics. Graphics disappears when scrolling is active and any node above collapses.
      _
      Steps to reproduce:
      resizing window or scrolling (except step 3) may frighten bug away
      1)expand root
      2)expand node 1 (or any from 0-3)
      3)scroll down
      you'll see this: http://i.imgur.com/z6VjIi9.png
      4)expand node 4
      5)collapse node 4
      graphics of "leaf 3" disappeared:
      http://i.imgur.com/OeLYOjY.png
      _
      it seems to behave randomly from run to run, for example some combination of expanded/colapsed nodes makes graphics of "leaf 1"&"leaf 3" disappear.
      _
      Here is my code for testing:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeView;
      import javafx.scene.image.Image;
      import javafx.scene.image.ImageView;
      import javafx.stage.Stage;

      public class TreeTest extends Application {
          
          @Override
          public void start(Stage primaryStage) {
              Image img = new Image("http://i.imgur.com/XzPRH5e.png");//originally image was loaded from my hard drive
              TreeView<String> root = new TreeView<>();
              TreeItem<String> n0 = new TreeItem<>("root");
              root.setRoot(n0);
              for(int t=0;t<5;t++){
                  TreeItem<String> n1 = new TreeItem<>("node "+t);
                  n0.getChildren().add(n1);
                  for(int i=0;i<5;i++){
                      TreeItem<String> n2 = new TreeItem<>("node "+t+" "+i);
                      n1.getChildren().add(n2);
                      for(int j=0;j<3;j++){
                          TreeItem<String> n3 = new TreeItem<>("leaf "+t+" "+i+" "+j);
                          n3.setGraphic(new ImageView(img));
                          n2.getChildren().add(n3);
                      }
                  }
              }
              for(int j=0;j<4;j++){
                  TreeItem<String> n1 = new TreeItem<>("leaf "+j);
                  n1.setGraphic(new ImageView(img));
                  n0.getChildren().add(n1);
              }
              Scene scene = new Scene(root, 300, 250);
              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
          
      }
      _
      User can make graphics visible again by scrolling up and down for example, but this "magic" anyway is not acceptable.
      Also I'm planning to use graphics to display states(no response/overloaded/overheated, etc.) and types of connected devices, so randomly disappearing graphics may be treated wrong.

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: