On Fri, 2 May 2025 10:32:42 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>> Implementation of 
>> [`StageStyle.EXTENDED`](https://gist.github.com/mstr2/0befc541ee7297b6db2865cc5e4dbd09).
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   simplify header area picking

Actually, it can easily be reproduced with plain Java + JavaFX; no libraries.

Turns out, the issue is down to doing:

` primaryStage.getScene().getStylesheets().addFirst(stylesheetUrl);
`


package com.certak.kafkio.gui;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HeaderBar;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import java.util.Objects;

public class WindowDecorationsStylesGoMissing extends Application {

    @Override
    public void start(Stage primaryStage) {
        primaryStage.initStyle(StageStyle.EXTENDED);
        BorderPane borderPane = new BorderPane();
        borderPane.setTop(new HeaderBar());

        Button click = new Button("Click");
        click.setOnAction(event -> {
            String stylesheetUrl = 
Objects.requireNonNull(AppSplashScreen.class.getResource("splash.css")).toExternalForm();
            primaryStage.getScene().getStylesheets().addFirst(stylesheetUrl);
        });
        borderPane.setCenter(click);

        Scene scene = new Scene(borderPane, 400, 300);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1605#issuecomment-2848853006

Reply via email to