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

Scene content shows too large on Retina display, when a regular screen attached

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u66
    • Fix Version/s: 9
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      other

      Backports

        Description

        FULL PRODUCT VERSION :
        1.8.0_66

        ADDITIONAL OS VERSION INFORMATION :
        Mac OS X 10.11.1, El Capitan

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Running on MacBook Pro 13", Retina, but with a regular screen attached through DisplayPort.

        A DESCRIPTION OF THE PROBLEM :
        When I have my non-Retina screen attached to my MacBook, my application's Scenes display far too large on the Retina screen. If I drag the window onto the non-Retina screen, they are corrected, when I drag the window back onto Retina, it remains correct. However, if my application opens another window, that Scene is far too large, until again, I drag it onto the non-Retina screen, and back onto the Retina screen.

        I have found that this only ever happens if my non-Retina screen is set as the primary screen in System Preferences, i.e. if the Mac menu bar is on the non-Retina screen. If I keep the Retina screen as the primary display, there is no bug. With only the Retina screen in use, there is no bug.

        It would appear that having the non-Retina screen as the primary display is the deciding factor of whether this bug happens, so perhaps on creating a Stage, the DPI it's getting from Screen is for the primary display, not the display the Stage is open on.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        This is easily replicate with:

        1) Create new JavaFX/FXML project in NetBeans.
        2) In the 'start' method, insert 'stage.setX(2500);', this will push the window off the external display and onto the laptop display, with the Scene displayed too large. More/less than 2500 will be needed depending on the pixel width of the external display.

        This will only work if the external display is the 'primary' display in System Preferences, i.e. it has the 'menu bar' in it in the Preferences window. If the Retina display is primary, no bug occurs.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        I would like the Scene to display at the correct size.
        ACTUAL -
        The Scene display far too large, looks about twice the size it should be, which makes sense.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        No crash, just displays far too big.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        /*
         * To change this license header, choose License Headers in Project Properties.
         * To change this template file, choose Tools | Templates
         * and open the template in the editor.
         */
        package retina;

        import javafx.application.Application;
        import javafx.fxml.FXMLLoader;
        import javafx.scene.Parent;
        import javafx.scene.Scene;
        import javafx.stage.Stage;

        /**
         *
         * @author gt
         */
        public class Retina extends Application {
            
            @Override
            public void start(Stage stage) throws Exception {
                Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
                
                Scene scene = new Scene(root);
                stage.setX(2500);
                stage.setScene(scene);
                stage.show();
            }

            /**
             * @param args the command line arguments
             */
            public static void main(String[] args) {
                launch(args);
            }
            
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        I can drag the window onto my non-Retina display and back again onto my Retina display, although this bug will prevent shipping.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                flar Jim Graham
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: