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

Labeled#setGraphic should throw exception if graphic is already a node in the scene-graph

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8
    • javafx
    • None

      The javadoc for Labeled's graphic property says "The node specified for this variable cannot appear elsewhere in the scene graph, otherwise IllegalArgumentException is thrown".

      The following code, then, should throw an IAE but it does not:

          @Override
          public void start(Stage stage) throws Exception {

              VBox root = new VBox(10);

              TextArea bar = new TextArea();
              root.getChildren().add(bar);

              Label label = new Label("foo", bar);
              root.getChildren().add(label);

              Scene scene = new Scene(root, 300, 250);
              stage.setScene(scene);
              stage.show();

          }

            Unassigned Unassigned
            dgrieve David Grieve
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: