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

[MenuItem] graphic cannot be removed.

    XMLWordPrintable

    Details

      Description

      Run the code:

          @Override
          public void start(Stage stage) {
              MenuBar mb = new MenuBar();

              Menu menu = new Menu("Some menu");
              mb.getMenus().add(menu);

              final MenuItem item = new MenuItem("MenuItem");
              item.setGraphic(new Rectangle(30, 30, Color.RED));

              menu.getItems().add(item);

              Button b = new Button("Remove graphic");
              b.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent event) {
                      item.setGraphic(null);
                  }
              });

              VBox vb = new VBox();
              vb.getChildren().addAll(mb, b);

              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }

      Click the button.

      Graphic node was not removed.

        Attachments

          Activity

            People

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

              Dates

              Due:
              Created:
              Updated:
              Resolved:
              Imported: