[EXTERNAL] Looked-up color fails for -fx-background-color in JavaFX CSS file
Kevin Rushforth
kevin.rushforth at oracle.com
Tue Jun 8 21:27:45 UTC 2021
If you have a test program, can you file it here?
https://bugreport.java.com/
Thanks.
-- Kevin
On 6/8/2021 2:12 PM, Duquette, Will (US 397J) wrote:
> The problem arises when I switch out the stylesheet for an active GUI, with code like this:
>
> root.getStylesheets().clear()
> root.getStylesheets().add(styleSheetURL)
>
> It's the clear() that's the problem. If add the new stylesheet and then remove the old one, no messages are produced.
>
> I have a simple test program, if you'd like to have this submitted to a bug tracker.
>
> Will Duquette
>
> On 6/8/21, 1:33 PM, "openjfx-dev on behalf of Duquette, Will (US 397J)" <openjfx-dev-retn at openjdk.java.net on behalf of william.h.duquette at jpl.nasa.gov> wrote:
>
> Howdy!
>
> I'm migrating a code-base from JavaFX 8 to JavaFX 11, and I'm seeing some weird behavior. I have some CSS that looks like this (in part)
>
> .root {
> -theme-button: #0679DE;
> }
>
> .button-primary {
> -fx-background-color: -theme-button;
> }
>
> It's been working great in JavaFX 8 for quite a long while. When I load the same app, I get messages like this written to the console.
>
> Jun 08, 2021 10:40:07 AM javafx.scene.CssStyleHelper calculateValue
> WARNING: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics at 11.0.11 of loader 'platform')' while converting value for '-fx-background-color' from rule '*.button-primary' in stylesheet file:/Users/will/github/dgs-tool/out/production/dgs-lib/dsn-dark.css
>
> Surprisingly, the color seems to still get set—but warnings written to the console are worrying.
>
> If I replace -theme-button with #0679DE in the .button-primary style, the message goes away.
>
> I'm seeing this for -fx-background-color and -fx-border-color, but not for any other places where I use looked-up colors.
>
> Any ideas?
>
>
>
More information about the openjfx-dev
mailing list