-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8
-
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.
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.)
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.)
- duplicates
-
JDK-8094242 Mac: Screen.getBounds() and Screen.getVisualBounds() return strange values for secondary screens on MacOS
- Resolved