Re: Looked-up color fails for -fx-background-color in JavaFX CSS file
I've tried the attached code as well, and I've been unable to reproduce it. I even modified the code a bit to clear and set the stylesheet every frame, and it runs fine. Also used the debugger a bit to see what's going on in CssStyleHelper#calculateValue but didn't see any obvious flaws. If you want, you could put a breakpoint on line 1634 in that class (just after #calculateValue's "catch(ClassCastException)") and see if you can see something odd going on. The stack trace might be useful to have, and perhaps why it occured if you could dig a bit deeper. The only way I could get it to fail is to put an actual bad value in "-theme-button". Are you doing anything else special while running the code? Or do you have a different example case that shows the problem? --John On 18/05/2022 18:05, Davide Perini wrote: Yes, I'm sorry, that was the issue. Thanks Davide Il 18/05/2022 14:10, Kevin Rushforth ha scritto: Hi Davide, Are you referring to https://bugs.openjdk.java.net/browse/JDK-8268657 ? I just tried it again, and it works fine for me. -- Kevin On 5/18/2022 4:12 AM, Davide Perini wrote: Hi all, someone else opened an issue in past on this problem. I have the exact same problem: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-June/030723.html Kevin closed the issue because it was not able to reproduce but I can reproduce it on JavaFX 18.0.1 Can you double check it please? Thanks Davide
Re: Looked-up color fails for -fx-background-color in JavaFX CSS file
Yes, I'm sorry, that was the issue. Thanks Davide Il 18/05/2022 14:10, Kevin Rushforth ha scritto: Hi Davide, Are you referring to https://bugs.openjdk.java.net/browse/JDK-8268657 ? I just tried it again, and it works fine for me. -- Kevin On 5/18/2022 4:12 AM, Davide Perini wrote: Hi all, someone else opened an issue in past on this problem. I have the exact same problem: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-June/030723.html Kevin closed the issue because it was not able to reproduce but I can reproduce it on JavaFX 18.0.1 Can you double check it please? Thanks Davide
Re: Looked-up color fails for -fx-background-color in JavaFX CSS file
Hi Davide, Are you referring to https://bugs.openjdk.java.net/browse/JDK-8268657 ? I just tried it again, and it works fine for me. -- Kevin On 5/18/2022 4:12 AM, Davide Perini wrote: Hi all, someone else opened an issue in past on this problem. I have the exact same problem: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-June/030723.html Kevin closed the issue because it was not able to reproduce but I can reproduce it on JavaFX 18.0.1 Can you double check it please? Thanks Davide
Re: Looked-up color fails for -fx-background-color in JavaFX CSS file
Could you share the program that reproduces this, as I didn't find an issue nor a sample program in the link you shared. You mentioned an issue was closed? Which issue? --John On 18/05/2022 13:12, Davide Perini wrote: Hi all, someone else opened an issue in past on this problem. I have the exact same problem: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-June/030723.html Kevin closed the issue because it was not able to reproduce but I can reproduce it on JavaFX 18.0.1 Can you double check it please? Thanks Davide
Looked-up color fails for -fx-background-color in JavaFX CSS file
Hi all, someone else opened an issue in past on this problem. I have the exact same problem: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-June/030723.html Kevin closed the issue because it was not able to reproduce but I can reproduce it on JavaFX 18.0.1 Can you double check it please? Thanks Davide
Looked-up color fails for -fx-background-color in JavaFX CSS file
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@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?
Re: [EXTERNAL] Looked-up color fails for -fx-background-color in JavaFX CSS file
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)" 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@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?
Re: [EXTERNAL] Looked-up color fails for -fx-background-color in JavaFX CSS file
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)" 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@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?