Summary
Allow developers to use a Dialog with StageStyle.EXTENDED.
Problem
Dialogs don't allow developers to install a HeaderBar, which is an obligatory control in order to create dialogs with StageStyle.EXTENDED.
Solution
Add a new DialogPane.headerBar property, which installs a HeaderBar at the top of the dialog window.
Specification
Dialog:
--- a/modules/javafx.controls/src/main/java/javafx/scene/control/Dialog.java
+++ b/modules/javafx.controls/src/main/java/javafx/scene/control/Dialog.java
@@ -461,10 +462,10 @@
}
/**
- * Specifies the style for this dialog. This must be done prior to making
- * the dialog visible. The style is one of: StageStyle.DECORATED,
- * StageStyle.UNDECORATED, StageStyle.TRANSPARENT, StageStyle.UTILITY,
- * or StageStyle.UNIFIED.
+ * Specifies the style for this dialog. This must be done prior to making the dialog visible.
+ * <p>
+ * Note that a dialog with the {@link StageStyle#EXTENDED} style should also specify a {@link HeaderBar} with
+ * the {@link DialogPane#setHeaderBar(HeaderBar)} method, as otherwise the dialog window will not be draggable.
*
* @param style the style for this dialog.
*
DialogPane:
--- a/modules/javafx.controls/src/main/java/javafx/scene/control/DialogPane.java
+++ b/modules/javafx.controls/src/main/java/javafx/scene/control/DialogPane.java
@@ -430,6 +434,74 @@
return imageUrl;
}
+ // --- header bar
+ private ObjectProperty<HeaderBar> headerBar;
+
+ /**
+ * Specifies the {@link HeaderBar} for the dialog. The {@code HeaderBar} will be placed at the
+ * top of the dialog window, and extend the entire width of the window. This property will only
+ * be used if the dialog window is configured with the {@link StageStyle#EXTENDED} style; it has
+ * no effect for other styles.
+ *
+ * @return the {@code headerBar} property
+ * @defaultValue {@code null}
+ * @since 26
+ * @deprecated This is a preview feature which may be changed or removed in a future release.
+ */
+ @Deprecated(since = "26")
+ public final ObjectProperty<HeaderBar> headerBarProperty()
+
+ /**
+ * Gets the value of the {@link #headerBarProperty() headerBar} property.
+ *
+ * @return the {@code HeaderBar}
+ * @since 26
+ * @deprecated This is a preview feature which may be changed or removed in a future release.
+ */
+ @Deprecated(since = "26")
+ public final HeaderBar getHeaderBar()
+
+ /**
+ * Sets the value of the {@link #headerBarProperty() headerBar} property.
+ *
+ * @param value the new value
+ * @since 26
+ * @deprecated This is a preview feature which may be changed or removed in a future release.
+ */
+ @Deprecated(since = "26")
+ public final void setHeaderBar(HeaderBar value)
- csr of
-
JDK-8370446 Support dialogs with StageStyle.EXTENDED
-
- Open
-