Ideally, we wouldn't have this sort of platform-specific behavior. I can see why the underlying platform might not support the concept of maximizing an undecorated stage, so we either need to disable it on Windows, live with the behavior, or else find some solution on macOS and Linux.

-- Kevin


On 1/6/2020 1:43 AM, Abhinay Agarwal wrote:
Hi,

If maximize property is set to true for an undecorated Stage, the following 
behaviour is observed on different platforms:

   *   Windows: Undecorated stage is maximized
   *   MacOS: Undecorated stage is not maximized
   *   Linux(Ubuntu): Undecorated stage is not maximized

The following piece of code can be used to reproduce the behaviour:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class MaximizedStage extends Application {
     public void start (Stage stage) {
         StackPane sp = new StackPane(new Label("Hello"));
         stage.setScene(new Scene (sp, 500, 500));
         stage.initStyle(StageStyle.UNDECORATED);
         stage.show();
         stage.setMaximized(true);
     }
}

  Is there a reason why the stage gets maximized on Windows but fails on other 
platforms?

Regards,
Abhinay

Reply via email to