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

Bounds of secondary screen on Mac OSX are reported incorrectly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      Java 1.8.0-b132 and Java 1.8.0_20-ea-b05 on Mac OSX 10.7.5. MacBook Pro with attached Thunderbolt display.

      Description

      The bounds of a secondary screen on Mac OS X seem to be reported as though reflected about the top horizontal axis of the secondary screen.

      I have a MacBook Pro with a Thunderbolt display attached. The system is configured with the Thunderbolt display as the primary display.
      System.out.println(Screen.getPrimary().getBounds());
      reports Rectangle2D [minX = 0.0, minY=0.0, maxX=2560.0, maxY=1440.0, width=2560.0, height=1440.0], which is correct.

      The laptop is configured as the secondary display, and is configured to sit to the left and lower than the primary display. The display has dimensions 1680x1050, and is offset to the left by 1680 pixels and down by 720 pixels relative to the primary display.

      Screen.getScreens().stream().map(Screen::getBounds).forEach(System.out::println) ;
      reports
      Rectangle2D [minX = 0.0, minY=0.0, maxX=2560.0, maxY=1440.0, width=2560.0, height=1440.0]
      Rectangle2D [minX = -1680.0, minY=-330.0, maxX=0.0, maxY=720.0, width=1680.0, height=1050.0]

      The correct output should be

      Rectangle2D [minX = 0.0, minY=0.0, maxX=2560.0, maxY=1440.0, width=2560.0, height=1440.0]
      Rectangle2D [minX = -1680.0, minY=720.0, maxX=0.0, maxY=1770.0, width=1680.0, height=1050.0]

      The second rectangle is reported as though it were reflected in its top edge.

      Complete code to reproduce:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.StackPane;
      import javafx.stage.*;
      public class ShowScreens extends Application {

      @Override
      public void start(Stage primaryStage) {
      Button button = new Button("Show Screens");
      button.setOnAction(event -> Screen.getScreens().stream().map(Screen::getBounds).forEach(System.out::println));
      primaryStage.setScene(new Scene(new StackPane(button), 200, 100)) ;
      primaryStage.show();
      }

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

      (But of course you will need a Mac with a couple of displays.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              anthony Anthony Petrov (Inactive)
              Reporter:
              jdenvirjfx James Denvir (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: