RFR: 8354795: DialogPane show details button wipes out base style class "hyperlink"

Andy Goryachev angorya at openjdk.org
Wed Apr 16 20:58:59 UTC 2025


On Wed, 16 Apr 2025 08:51:36 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> The "show details" hyperlink button in an alert dialog that has an expandable detail area wipes out its base style class by overwriting all styles. This means styling in modena.css that targets `.hyperlink` is no longer applied, like the default text fill colors.
> 
> The culprit is this code in DialogPane:
> 
>         InvalidationListener expandedListener = o -> {
>             final boolean isExpanded = isExpanded();
>             detailsButton.setText(isExpanded ? lessText : moreText);
>             detailsButton.getStyleClass().setAll("details-button", (isExpanded ? "less" : "more")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
>         };
> 
> Here it uses `setAll` to set styles, wiping out the default `.hyperlink` style from "Hyperlink detailsButton = new HyperLink()"

modules/javafx.controls/src/main/java/javafx/scene/control/DialogPane.java line 822:

> 820:         final ObservableList<String> styleClasses = detailsButton.getStyleClass();
> 821: 
> 822:         styleClasses.add("details-button");  //$NON-NLS-1$

do we use these `//$NON-NLS-1$` in jfx?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1779#discussion_r2047750714


More information about the openjfx-dev mailing list