JDK-8255835 : [macOS] Undecorated stage cannot be maximized
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx11,8,jfx14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2020-11-03
  • Updated: 2023-11-17
  • Resolved: 2023-11-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx22 b16Fixed
Related Reports
Cloners :  
Description
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



Comments
Changeset: f41e3ec0 Author: Martin Fox <beldenfox@users.noreply.github.com> Committer: Andy Goryachev <angorya@openjdk.org> Date: 2023-11-01 20:38:26 +0000 URL: https://git.openjdk.org/jfx/commit/f41e3ec02bdbdff1417ed20b8e02645348825e4d
01-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jfx/pull/1258 Date: 2023-10-12 05:52:04 +0000
26-10-2023

This bug will be used to track the failure to maximize an undecorated stage on macOS.
03-11-2020