Help test the behavior of a multi-screen setup with both Mac and Windows
Andy Goryachev
andy.goryachev at oracle.com
Wed Apr 9 15:08:56 UTC 2025
Here are the results on macOS 15.3.2, with the primary (retina, scale=2) at the bottom and the external (scale=1) at the top like so
[cid:image001.png at 01DBA925.BCAC1580]
In both cases, the first button (Move To 1800.0) moves the window to the same screen partially outside of the viewing area (only about ~15% of the left side remains visible), while the other button (Move To 900.0) shifts to the right.
My setup uses the setting [Desktop & Dock -> Displays have separate Spaces OFF] so I can move the windows between the monitors.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Thiago Milczarek Sayão <thiago.sayao at gmail.com>
Date: Wednesday, April 9, 2025 at 03:56
To: openjfx-dev <openjfx-dev at openjdk.org>
Subject: Help test the behavior of a multi-screen setup with both Mac and Windows
Hi,
Could anyone with a multi-screen setup on Mac and/or Windows please share the results of the two buttons on this sample app? Your feedback would be greatly appreciated!
On Ubuntu 24.04 the first button moves the Stage to the end of the first screen (bit weird).
The second work as expected, it gets moved to the start of the center of the last screen.
Thanks!
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.geometry.Rectangle2D;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Screen;
import javafx.stage.StageStyle;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.util.Comparator;
public class TestScreenBounds extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("Move Outside Bounds");
Rectangle2D bounds = Screen.getScreens().stream()
.map(Screen::getBounds)
.sorted(Comparator.comparingDouble(Rectangle2D::getMaxX).reversed())
.findFirst()
.orElseThrow();
Button btn = new Button("Move To " + bounds.getMaxX());
btn.setOnAction(event -> stage.setX(bounds.getMaxX()));
double middleLastScreen = bounds.getMinX() + bounds.getWidth() / 2;
Button btn2 = new Button("Move To " + middleLastScreen);
btn2.setOnAction(event -> stage.setX(middleLastScreen));
VBox root = new VBox(btn, btn2);
root.setFillWidth(true);
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 300, 300);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(TestScreenBounds.class, args);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250409/d85fa2e2/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5055 bytes
Desc: image001.png
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250409/d85fa2e2/image001-0001.png>
More information about the openjfx-dev
mailing list