RFR: 8370446: Support dialogs with StageStyle.EXTENDED
Cormac Redmond
duke at openjdk.org
Thu Oct 23 16:27:24 UTC 2025
On Tue, 21 Oct 2025 23:54:55 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
> Adds the `Dialog.headerBar` property, which allows developers to specify a custom `HeaderBar` when the dialog uses the `EXTENDED` stage style. The property is ignored for all other stage styles.
The nature of when and how DialogPane's "scene" is available seems to have changed.
For example, consider this (very old) code of mine:
public class BaseDialog<T> extends Dialog<T> implements CtDialog<T> {
protected BaseDialog() {
getDialogPane().getScene().setOnKeyPressed(event -> {
<...SNIP....>
Now I get an NPE because getScene() is null even after a dialog pane is set, presumably because of the changes to HeavyweightDialog.setDialogPane().
It might be incorrect to _assume_ a scene is assigned at this point (...?), but it is and has been for a long time...
E.g., simply instantiating a Dialog would have created a scene immediately via setDialogPane() previously:
public Dialog() {
this.setDialogPane(new DialogPane());
this.initModality(Modality.APPLICATION_MODAL);
}
... which is now not the case. Would you consider this a breaking change?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1943#issuecomment-3434400215
More information about the openjfx-dev
mailing list