<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">I should add, it's the same problem for other standard controls like ChoiceDialog and TextInputDialog. It's not (easily/feasibly) possible to customise the header bar / window buttons for these dialogs either.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, 20 Oct 2025 at 23:04, Cormac Redmond <<a href="mailto:credmond@certak.com">credmond@certak.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hi,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I touched on this before, but I still think there are gaps that should be addressed with using HeaderBars and Alerts/Dialogs/DialogPanes.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">There's a bunch of logic in Alert/Dialog/DialogPane regarding headerText vs. headerNode precedence, graphic node placement, etc., which all depends on what is set and when, etc.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><div class="gmail_default">To incorporate HeaderBar into Dialogs, the advice before was to "get" the existing header node, if it's there, and set it as the center of a new BorderPane and stick the HeaderBar as top, and set that BorderPane as the DialogPane's header, in order to use HeaderBar. But that only partially solves some problems, some of the time.</div></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">If you use a HeaderBar for the purpose I do: to control the color (get rid of the ugly white bg) & to to save some precious space (i.e., get a menu system on the left + window icons on the right) *and* want a consistent look and feel across your application regarding popups, you must sacrifice all of this "standard" functionality of standard Alerts/Dialogs; <i><b>or</b></i> don't use HeaderBar for dialogs -- which looks unpolished and lacking.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Look at this example (which only touches the surface):</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default"><font face="monospace">public class HeaderBarSupport extends Application {<br><br> private boolean INSTALL_HEADER_BAR = true;<br><br> @Override<br> public void start(Stage primaryStage) {<br> showErrorDialogHeaderText("title", "will see this", "content", !INSTALL_HEADER_BAR); // No HeaderBar, all is fine<br> showErrorDialogHeaderText("will not see this title", "will not see this header text", "content", INSTALL_HEADER_BAR); // Won't see title, headerText, or big red X<br> }<br><br> private void showErrorDialogHeaderText(String title, String headerText, String content, boolean installHeaderBar) {<br> Alert alert = new Alert(Alert.AlertType.ERROR, content); // Expect error<br> alert.setTitle(title);<br> alert.setHeaderText(headerText);<br> alert.setContentText(content);<br><br> if (installHeaderBar) {<br> installHeaderBar(alert);<br> }<br><br> alert.showAndWait();<br> }<br><br> private void installHeaderBar(final Dialog dialog) {<br> Node existingHeader = dialog.getDialogPane().getHeader(); // null in these examples<br> BorderPane borderPane = new BorderPane();<br> // Note: could set a label with title in the HeaderBar if desired, but that's about as much as you can salvage<br> borderPane.setTop(new HeaderBar());<br> borderPane.setCenter(existingHeader);<br> dialog.getDialogPane().setHeader(borderPane);<br> dialog.initStyle(StageStyle.EXTENDED);</font></div><div class="gmail_default"><font face="monospace"> }<br><br> public static void main(String[] args) {<br> launch(args);<br> }<br>}</font></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Kind Regards,</div><div class="gmail_default" style="font-family:verdana,sans-serif">Cormac</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div>
</blockquote></div>