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

[CSS] Context menu has larger than expected background area if non-transparent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 9
    • 8u25
    • javafx
    • Java8u25

      Context menu has extra area when I set CSS ( .root{ -fx-background-color or -fx-background-image }) to scene on Java8.
      on Java7 : http://i.imgur.com/xm3SRoj.jpg
      on Java8 : http://i.imgur.com/xtU7HQj.jpg

      ・code

      @Override
      public void start(Stage primaryStage) {
          MenuBar bar = new MenuBar();
          Menu menu = new Menu("File");
          MenuItem item = new MenuItem("exit");
          menu.getItems().add(item);
          bar.getMenus().add(menu);
          bar.setPrefWidth(300);
          
          AnchorPane root = new AnchorPane();
          root.setStyle("-fx-background-color: white;");
          root.getChildren().add(bar);
          AnchorPane.setTopAnchor(bar, 0.0);
                 
          Scene scene = new Scene(root, 300, 250);
          scene.getStylesheets().add(this.getClass().getResource("/javafxapplication/style.css").toExternalForm());
          
          primaryStage.setTitle("Hello World!");
          primaryStage.setScene(scene);
          primaryStage.show();
      }


      ・style.css

      .root{
          -fx-background-color: red;
      }


            jgiles Jonathan Giles
            kitsunesajfx kitsunesaki (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: