On Tue, 21 Oct 2025 23:54:55 GMT, Michael Strauß <[email protected]> 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. I've found a layout issue when using HeaderBar in Dialogs. This only occurs when: - you use a HeaderBar - a preferred width is set on the DialogPane When using HeaderBar (clipped): <img width="400" height="132" alt="image" src="https://github.com/user-attachments/assets/cd179f8c-7ea4-4024-9b6b-a84aac09475c" /> When not using HeaderBar: <img width="402" height="193" alt="image" src="https://github.com/user-attachments/assets/5fda8a0f-322c-42c5-bc82-e083f375a411" /> Code to reproduce: public class DialogBugDemo extends Application { @Override public void start(Stage stage) { Button infoBtn = new Button("Show Two Alerts"); infoBtn.setOnAction(e -> { showInfo(true); // With HeaderBar - content clipping issue showInfo(false); // Without HeaderBar - works fine }); stage.setScene(new Scene(new VBox(10, infoBtn), 400, 300)); stage.show(); } private void showInfo(boolean withHeaderBar) { Alert alert = new Alert(AlertType.INFORMATION); alert.setHeaderText(null); // Set preferred width causing the issue to manifest, no issue without it alert.getDialogPane().setPrefWidth(400); // Comment out and bug goes away alert.getDialogPane().setContent(createVbox()); // Display issues only occur when HeaderBar is set if (withHeaderBar) { alert.setHeaderBar(new HeaderBar()); alert.initStyle(StageStyle.EXTENDED); } alert.show(); } private VBox createVbox() { TextFlow tf = new TextFlow( new Text("1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0; end of first TextFlow.") ); TextFlow tf2 = new TextFlow( new Text("1 2 3 4 5 6 7 8 9 0 1 sdf 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0; end of second TextFlow.") ); return new VBox(tf, new VBox(tf2)); } public static void main(String[] args) { launch(args); } } ------------- PR Comment: https://git.openjdk.org/jfx/pull/1943#issuecomment-3438695394
