RFR: JDK-8326619: Stage.sizeToScene() on maximized/fullscreen Stage breaks the Window

Marius Hanl mhanl at openjdk.org
Fri Mar 8 16:42:57 UTC 2024


On Wed, 28 Feb 2024 23:43:40 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> This seems like a reasonable fix and spec change. Have you tested the case of calling sizeToScene before setting full-screen or maximzed? Since the pending flag will still be set in that case, I want to make sure that case is tested as well.

I thought about this as well but could not find any problem at least on Windows.
If we want to be perfectly safe, we may still want to set the flag when `sizeToScene()` is called. What do you think?

I used the following code to test this, and it didn't matter when `sizeToScene()` was called:


   @Override
    public void start(Stage primaryStage) throws Exception {
        StackPane root = new StackPane();
        Button wss = new Button("Wss");
        wss.setPrefSize(50, 50);
        root.getChildren().add(wss);

        Scene scene = new Scene(root);

        Stage stage = new Stage();
        stage.setWidth(500);
        stage.setMaximized(true);
        stage.sizeToScene();
        stage.setScene(scene);
        stage.show();
    }

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1382#issuecomment-1986030015


More information about the openjfx-dev mailing list