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

Menu misalignment when using dual monitor setup

XMLWordPrintable

    • x86
    • other

      FULL PRODUCT VERSION :
      1.8.0_152-ea

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.14393]

      A DESCRIPTION OF THE PROBLEM :
      Using Windows 10 with a dual hi dpi monitor setup.
      Monitor 1 has a resolution of 3360x2100
      Monitor 2 has a resolution of 4096x2034

      Monitor 1 is set as the main display.

      If you run the test program and drag it to Monitor 2, you will notice that the menu is not aligned. I.e depending where the app is on the screen when you select the menu with the mouse, the actual menu pop up will be on another part of the screen.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test application, drag it to the second monitor and select a menu item.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The menu should be aligned with the menu item selected.
      ACTUAL -
      The menu is not aligned with the menu selected.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.*;
      import javafx.scene.control.*;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class MenuApp extends Application {

          public Parent createContent() {

              VBox vbox = new VBox(20);
              vbox.setPrefSize(300, 200);
              final MenuBar menuBar = new MenuBar();
              Menu m1 = new Menu("one");
              m1.getItems().addAll(new MenuItem("111"), new MenuItem("222"));
              Menu m2 = new Menu("two");
              m2.getItems().addAll(new MenuItem("aaa"), new MenuItem("bbb"));
              Menu menu = new Menu("menu");
              menu.getItems().addAll(m1, m2);
              menuBar.getMenus().addAll(menu);
              vbox.getChildren().addAll(menuBar);
              return vbox;
              
              
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(createContent()));
              primaryStage.show();
          }

          public static void main(String[] args) { launch(args); }
      }
      ---------- END SOURCE ----------

            scfitch Stephen Fitch
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: