RFR: 8313424: JavaFX controls in the title bar (Preview) [v81]
Cormac Redmond
duke at openjdk.org
Sat Jun 7 00:38:10 UTC 2025
On Thu, 5 Jun 2025 00:50:30 GMT, Michael Strauß <mstrauss at 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:
>
> rename WindowManager to DesktopEnvironment
It appears that the CSS of the Window icons cannot be overridden; see below example which doesn't apply css.css.
What is the proper/expected way to style the window icons; and should there be some documentation on this somewhere in HeaderBar?
public class MyApp extends Application {
@Override
public void start(Stage stage) {
Button button = new Button("My button");
HeaderBar.setAlignment(button, Pos.CENTER_LEFT);
HeaderBar.setMargin(button, new Insets(5));
HeaderBar headerBar = new HeaderBar();
headerBar.setCenter(button);
// Doesn't apply to window icons
headerBar.getStylesheets().add(Objects.requireNonNull(getClass().getResource("css.css")).toExternalForm());
BorderPane root = new BorderPane();
root.setTop(headerBar);
Scene scene = new Scene(root);
// Doesn't apply to window icons
scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("css.css")).toExternalForm());
stage.setScene(scene);
stage.initStyle(StageStyle.EXTENDED);
stage.show();
}
}
**css.css** (put in same directory as class)
.iconify-button:hover,
.maximize-button:hover {
-fx-background-color: green;
}
.iconify-button.dark:hover,
.maximize-button.dark:hover {
-fx-background-color: yellow;
}
.close-button:hover {
-fx-background-color: pink;
}
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1605#issuecomment-2951311555
More information about the openjfx-dev
mailing list