-
Bug
-
Resolution: Unresolved
-
P3
-
jfx20, jfx22, jfx23, jfx24
-
x86_64
-
windows
ADDITIONAL SYSTEM INFORMATION :
Tested on Windows 10
Java JDK 24-ea+19
JavaFX 24-ea+13
A DESCRIPTION OF THE PROBLEM :
When the stage.minHeightProperty() is binded to stage.heightProperty() and stage.getScene().heightProperty(), a stack overflow will likely happen if the Windows "Display > Scale and layout > Change the size of text, apps and other items" is changed with the application open.
The purpose of binding to those properties is to account for the title bar height when setting the stage min height.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the source code.
2. Resize the window to the minimum size.
3. In Windows Settings, change the "Display > Scale and layout > Change the size of text, apps and other items" setting to a new higher value.
3. Repeat previous step if needed, this issue should reproduce within a few attempts.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window is scaled using the new percentage value.
ACTUAL -
A stack overflow occurs, the window height exceeds the screen height.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class HelloFX extends Application {
private Stage stage;
@Override
public void start(Stage stage) {
this.stage = stage;
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
StackPane layout = new StackPane();
StackPane layout2 = new StackPane();
layout.getChildren().add(layout2);
layout.getChildren().add(new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."));
BackgroundFill bf = new BackgroundFill(Color.valueOf("#f00"), new CornerRadii(8), Insets.EMPTY);
layout2.setBackground(new Background(bf));
layout2.setMinHeight(500);
layout2.setMaxHeight(500);
layout2.setMinWidth(500);
layout2.setMaxWidth(500);
Scene scene = new Scene(layout, 500, 500);
stage.setScene(scene);
stage.setMinWidth(500);
stage.minHeightProperty().bind(stage.heightProperty().subtract(scene.heightProperty()).add(500));
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
FREQUENCY : often
Tested on Windows 10
Java JDK 24-ea+19
JavaFX 24-ea+13
A DESCRIPTION OF THE PROBLEM :
When the stage.minHeightProperty() is binded to stage.heightProperty() and stage.getScene().heightProperty(), a stack overflow will likely happen if the Windows "Display > Scale and layout > Change the size of text, apps and other items" is changed with the application open.
The purpose of binding to those properties is to account for the title bar height when setting the stage min height.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the source code.
2. Resize the window to the minimum size.
3. In Windows Settings, change the "Display > Scale and layout > Change the size of text, apps and other items" setting to a new higher value.
3. Repeat previous step if needed, this issue should reproduce within a few attempts.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window is scaled using the new percentage value.
ACTUAL -
A stack overflow occurs, the window height exceeds the screen height.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class HelloFX extends Application {
private Stage stage;
@Override
public void start(Stage stage) {
this.stage = stage;
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
StackPane layout = new StackPane();
StackPane layout2 = new StackPane();
layout.getChildren().add(layout2);
layout.getChildren().add(new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."));
BackgroundFill bf = new BackgroundFill(Color.valueOf("#f00"), new CornerRadii(8), Insets.EMPTY);
layout2.setBackground(new Background(bf));
layout2.setMinHeight(500);
layout2.setMaxHeight(500);
layout2.setMinWidth(500);
layout2.setMaxWidth(500);
Scene scene = new Scene(layout, 500, 500);
stage.setScene(scene);
stage.setMinWidth(500);
stage.minHeightProperty().bind(stage.heightProperty().subtract(scene.heightProperty()).add(500));
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
FREQUENCY : often