mkpaz / atlantafx

Modern JavaFX CSS theme collection with additional controls.
https://mkpaz.github.io/atlantafx
MIT License
829 stars 66 forks source link

AtlantaFX themes cause ClassCastException with scrollbars, listview and scrollbar #65

Closed CodeDead closed 1 year ago

CodeDead commented 1 year ago

Getting occasional exceptions when using the AtlantaFX themes like Dracula and Cupertino with scrollbars, listviews, comboboxes and scrollbars:

Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-border-color' from rule '*.list-view' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Color (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Color is in module javafx.graphics@20.0.1 of loader 'app')' while converting value for '-fx-effect' from rule '*.combo-box-popup>*.list-view' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.combo-box-popup>*.list-view' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-color-fg-default' while resolving lookups for '-fx-text-fill' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-color-fg-emphasis' while resolving lookups for '-fx-text-fill' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell:hover:filled:selected' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell:hover:filled:selected' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-color-fg-default' while resolving lookups for '-fx-text-fill' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-color-fg-default' while resolving lookups for '-fx-text-fill' from rule '*.list-view *.list-cell' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.list-view *.list-cell' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.scroll-bar' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.thumb' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.scroll-bar' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.thumb' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss
Jul 08, 2023 4:02:23 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@20.0.1 of loader 'app')' while converting value for '-fx-background-color' from rule '*.list-view>*.virtual-flow>*.corner' in stylesheet jar:file:///home/deadline/.gradle/caches/modules-2/files-2.1/io.github.mkpaz/atlantafx-base/2.0.1/51d2bfa35150921fe5b8b5e3c1a1bf78a6d57684/atlantafx-base-2.0.1.jar!/atlantafx/base/theme/dracula.bss

For an example project, check out: https://github.com/CodeDead/opal/tree/development

Dependencies:

Cause:

First, set the theme to the old Modena or Caspian theme included in JavaFX, then switch the theme back to any AtlantaFX based theme like Dracula or Cupertino. Sometimes, this also happens when switching between Caspian and Modena.

Application.setUserAgentStylesheet(Application.STYLESHEET_CASPIAN);
Application.setUserAgentStylesheet(new Dracula().getUserAgentStylesheet());

Thoughts:

It does not happen every time and the issue seems to be very sporadic, as in it comes and goes. It can also occur when switching from Caspian to Modena.

mkpaz commented 1 year ago

I noticed that heisenbug too. It sometimes happens when switching themes, looks like some sort of concurrency issue. It's been reported here, but it's hard to reproduce. I'll close this, because I don't see how I can help here. Perhaps using BSS could be a potential solution.