B4J Question Setting a TextArea base with a gradient fails

MrKim

Well-Known Member
Licensed User
Longtime User
This works
B4X:
                TA.Style = ";-fx-base:red"  '  { box-shadow: 0 20px 50px rgba(59, 43, 91, 0.7); }"

This does not
B4X:
TA.Style = ";-fx-base:linear-gradient(from 10% 10% To 80% 80%, red 0%, black 100%)"

here is a portion of the error messages - it repeats.
B4X:
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-input:focused' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-area:focused *.content' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar:vertical' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.increment-button>*.increment-arrow' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.decrement-button>*.decrement-arrow' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar:vertical>*.thumb' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar:horizontal' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.increment-button>*.increment-arrow' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.decrement-button>*.decrement-arrow' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.thumb' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:36 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-pane>*.corner' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-highlight-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-highlight-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-area' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-prompt-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-area *.content' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar:vertical' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 5:42:39 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.scroll-bar>*.increment-button>*.increment-arrow' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
I really would like to be able to set a gradient on (or behind?) TextArea. It is communicating information - progress bar.
I would prefer to do it without additional nodes. In the end there might be 100 or more of these and adding additional nodes just complicates the code and slows down performance.

Thanks for your help

Update:
I also tried
B4X:
TA.Style = ";-fx-control-inner-background: linear-gradient(To bottom right, red, black)"
which fails with
B4X:
Jan 30, 2020 6:03:41 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-input:focused' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:41 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:41 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-area:focused *.content' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:45 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-highlight-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:45 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:45 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-highlight-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:45 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-prompt-text-fill' from rule '*.text-input' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Jan 30, 2020 6:03:45 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-background-color' from rule '*.text-area *.content' in stylesheet jar:file:/D:/AndroidX/Java/jdk1.8.0_131/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
You could try setting it in a stylesheet.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I would prefer to do it without additional nodes. In the end there might be 100 or more of these and adding additional nodes just complicates the code and slows down performance.
They don't slow down performance. They also don't complicate the code if built correctly.
 
Upvote 0
Top