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

[TreeView] setGraphic is not rendered immidiately

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7u6, 8
    • javafx
    • 2.2.0b21, developers build 8.0

      Code:

          @Override
          public void start(Stage stage) throws Exception {
              final TreeItem tn = new TreeItem("root");
              TreeItem tn1 = new TreeItem("node1");
              TreeView treeView = new TreeView(tn);
              tn.getChildren().add(tn1);

              final Button button = new Button("Apply graphic");
              button.setOnAction(new EventHandler<ActionEvent>() {

                  @Override
                  public void handle(ActionEvent t) {
                      tn.setGraphic(new Rectangle(0, 0, 10, 10));
                  }
              });
              VBox pane = new VBox();
              pane.getChildren().addAll(treeView, button);
              Scene scene = new Scene(pane, 300, 700);
              stage.setScene(scene);
              stage.show();
          }

      Look at the attached movie.

      I set new graphic (on movie, using binding, in the attached code, using setter). You can see, that change listener in movie notified, that rectangle became a value of graphic property of node (ROOT). But it will be applied, on when node will be expanded/collapsed.

      To reproduce - click the button in the attached code, and expand or collapse a node.

            jgiles Jonathan Giles
            akirov Alexander Kirov (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: