RFR: 8359601: Fix window button states of an extended stage [v2]
Cormac Redmond
duke at openjdk.org
Tue Jun 17 00:46:32 UTC 2025
On Tue, 17 Jun 2025 00:37:22 GMT, Cormac Redmond <duke at openjdk.org> wrote:
> Another suspected issue (not really related to this PR), close request handlers are not called when using EXTENDED. E.g.:
>
> ```
> stage.setOnCloseRequest(event -> {
> System.out.println("Never called...");;
> });
> ```
>
> Same for dialogs...
Sample:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class MinimiseIconEnabledBug extends Application {
@Override
public void start(Stage primaryStage) {
Button button = new Button("Click");
button.setOnAction(e -> {
final Dialog<Object> dialog = new Dialog<>();
dialog.initOwner(primaryStage);
// dialog.initStyle(StageStyle.EXTENDED); // uncomment for bug
dialog.initModality(Modality.NONE);
dialog.setResizable(true); // This is important
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
dialog.setOnCloseRequest(dialogEvent -> {
System.out.println("Close the dialog pane. This is not called when EXTENDED is used.");
});
dialog.show();
});
StackPane root = new StackPane(button);
Scene scene = new Scene(root, 300, 200);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1831#issuecomment-2978574395
More information about the openjfx-dev
mailing list