-
Bug
-
Resolution: Unresolved
-
P4
-
jfx21
-
None
-
Fedora release 38 (Thirty Eight)
GNOME Shell 44.2
javafx-sdk-21.0.2
-
x86
-
linux
Using the following test program:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class HelloWorld extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(e -> {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText(System.getProperty("javafx.runtime.version") + ": Look, an Information Dialog, it may contain quite the long text.");
alert.setContentText("I have a great message for you! This dialog works in every Linux desktop environment, except Gnome");
alert.setResizable(true);
alert.showAndWait();
});
StackPane root = new StackPane();
root.getChildren().add(btn);
Scene scene = new Scene(root, 1024, 600);
primaryStage.setScene(scene);
primaryStage.show();
}
}
When the "Hello World" button is clicked the alert is displayed in a window sized 200x200 px (plus title bar).
Strangely enough this only happens when using Gnome. Other window managers (like KDE, fluxbox, i3) do not show that behaviour.
It also only happens in JavaFX 21. When using older versions of JavaFX the dialog is displayed as expected.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class HelloWorld extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(e -> {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText(System.getProperty("javafx.runtime.version") + ": Look, an Information Dialog, it may contain quite the long text.");
alert.setContentText("I have a great message for you! This dialog works in every Linux desktop environment, except Gnome");
alert.setResizable(true);
alert.showAndWait();
});
StackPane root = new StackPane();
root.getChildren().add(btn);
Scene scene = new Scene(root, 1024, 600);
primaryStage.setScene(scene);
primaryStage.show();
}
}
When the "Hello World" button is clicked the alert is displayed in a window sized 200x200 px (plus title bar).
Strangely enough this only happens when using Gnome. Other window managers (like KDE, fluxbox, i3) do not show that behaviour.
It also only happens in JavaFX 21. When using older versions of JavaFX the dialog is displayed as expected.
- relates to
-
JDK-8306121 Scene not rendered initially when changing scenes after fix for JDK-8296621
- Resolved