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

MenuButton size does not respect ImageView size

    Details

      Description

      When setting a graphic for a MenuButton the size of the imageView is ignored. Execute the test case below, the size of both images should be equal - in Java8b106 it works fine, in Java8b116 the MenuButton ignores the fitHeight setting for some reason. I don't know which release introduced the issue because I haven't tested all releases between the mentioned.

      public class MenuButtonGraphicsTest extends Application
      {
        public static void main(String[] args)
        {
          Application.launch(args);
        }

        @Override
        public void start(Stage stage)
        {
          System.err.println(System.getProperty("javafx.runtime.version"));
          Scene scene = new Scene(createContentPane(), 400, 300);
          stage.setScene(scene);
          stage.setTitle(getClass().getSimpleName());
          stage.show();
        }

        private Parent createContentPane()
        {
          Pane content = new FlowPane(10, 10);
          MenuButton menuButton = new MenuButton();
          ImageView imageView = new ImageView(getClass().getResource("/com/sun/javafx/scene/control/skin/modena/HTMLEditor-Background-Color-Black@2x.png").toExternalForm());
          imageView.setFitHeight(16);
          menuButton.setGraphic(imageView);
          content.getChildren().add(menuButton);

          ImageView imageView2 = new ImageView(getClass().getResource("/com/sun/javafx/scene/control/skin/modena/HTMLEditor-Background-Color-Black@2x.png").toExternalForm());
          imageView2.setFitHeight(16);
          content.getChildren().add(imageView2);
          
          return content;
        }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgrieve David Grieve (Inactive)
                Reporter:
                wzberger Wolfgang Zitzelsberger
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: