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

[macOS] Undecorated stage cannot be maximized

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      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

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the sample on different operating systems



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The stage should be maximized on all platform or should not maximize on any platform

      ACTUAL -
      The stage is maximized on Windows but doesn't maximize on Linux or Mac OS

      ---------- BEGIN SOURCE ----------
      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);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Current workaround is to find the dimensions of the screen on which to the stage is to be shown and update the width and height of the Stage.

      stage.initStyle(StageStyle.UNDECORATED);
      stage.setWidth(Screen.getPrimary().getBounds().getWidth());
      stage.setHeight(Screen.getPrimary().getBounds().getHeight());
      stage.show();

      FREQUENCY : always


            mfox Martin Fox
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: