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

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



      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:
      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 {
          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");
              for(int t=0;t<5;t++){
                  TreeItem<String> n1 = new TreeItem<>("node "+t);
                  for(int i=0;i<5;i++){
                      TreeItem<String> n2 = new TreeItem<>("node "+t+" "+i);
                      for(int j=0;j<3;j++){
                          TreeItem<String> n3 = new TreeItem<>("leaf "+t+" "+i+" "+j);
                          n3.setGraphic(new ImageView(img));
              for(int j=0;j<4;j++){
                  TreeItem<String> n1 = new TreeItem<>("leaf "+j);
                  n1.setGraphic(new ImageView(img));
              Scene scene = new Scene(root, 300, 250);
              primaryStage.setTitle("Hello World!");

          public static void main(String[] 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.




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


              • Created: