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

JavaFX menu shows up in the wrong location when GUI spans HiDPI and non-HiDPI

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 64 bit
      Java 1.8.0_191 (although I have also verified/tested OpenJDK 10.0.2 as well but I can't create a bug report there)

      A DESCRIPTION OF THE PROBLEM :
      I have a JavaFX based application and the main menu on it becomes "broken" when Windows scaling is turned on and the GUI spans monitors. This likely works with any JavaFX based menu and I verified that I can replicate the issue with the following arbitrary example that I found online:
      https://www.javaworld.com/article/2074463/core-java/-pure-java--javafx-2-0-menus.html

      If I can attach screenshots to this bug report later then I will do so.

      I have also had another issue where clicking on the menu item causes it to show for a very brief period of time and then disappear but this is much harder to replicate. I will either update this bug or raise a new one if I can find a reliable way to replicate it. However, I believe it is related to this bug.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      To replicate you need:
      - a JavaFX GUI with a menu
      - two or more monitors
      - one monitor with 100% scaling and the other with 150% scaling (I've only tested it with those two settings), to set the scaling on Windows 10 do the following:
         - right click on desktop and go to Display settings
         - click on one monitor and verify that it's at 100% (Recommended) in the "Scale and layout" section
         - do the same for another monitor but set it to 150%

      Then:
      - run the JavaFX app with menu and drag it so that the majority of the app is on the 150% scaled monitor
      - try to position the app so that part of the menu is on the 100% monitor and part is on the 150% monitor
      - when you open the menu items on the 150% monitor, those items are opened, scaled to 150%, and show in the correct location
      - when you open the menu items on the 150% monitor, those items are opened, scaled to 100% (instead of 150%) and show in an incorrect location
      - Note: In the Windows 10 Display settings, you can also click on the monitors to arrange them relative to each other. For example, you can move the monitor with 100% scaling so that its top is above the top of the monitor with 150% scaling. The location where the incorrect menu opens is relative to how these monitors are positioned in these Windows settings.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Presumably, if the GUI itself is scaled because the majority of it is on the scaled monitor, then the entire menu should open scaled, whether it is opened on the monitor with 150% scaling or not.
      All menu items should open in the expected locations.
      ACTUAL -
      The menu items opened on the 100% scaled monitor are opened with 100% scaling and show up in the wrong location. The location is relative to the "virtual positioning" of the monitors within the Windows 10 Display settings.

      ---------- BEGIN SOURCE ----------
      https://www.javaworld.com/article/2074463/core-java/-pure-java--javafx-2-0-menus.html
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No work around at this time.
      I tried running with "-Dprism.allowhidpi=false" but it doesn't seem to have any impact at all on the scaling.

        Attachments

        1. Incorrect_Pos_Menu_1.png
          10 kB
          Priyanka Mangal
        2. Incorrect_Pos_Menu_2.png
          19 kB
          Priyanka Mangal
        3. JavaFxMenus.java
          4 kB
          Priyanka Mangal

          Issue Links

            Activity

              People

              Assignee:
              arapte Ambarish Rapte
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated: