https://kotlinlang.org logo
#tornadofx
Title
# tornadofx
r

Ruckus

01/29/2019, 7:23 AM
@Dustin Jensen That might not mean what you might expect, as that syntax is specific to a JavaFX feature that isn't present in standard CSS. The commas are actually separating three different backgrounds, not three different values. It's actually the same as
Copy code
-fx-background-insets: 2.0 2.0 2.0 2.0, 0.0 0.0 0.0 0.0, 0.0 0.0 0.0 0.0;
which says
Give all 4 sides of background 1 an inset of 2 pixels, and all for sides of backgrounds 2 and 3 an inset of 0 pixels
Unlike standard CSS, JavaFX allows stacking multiple backgrounds, which is where the comma syntax came from. In the CSS DSL, you'll see that in places where you use
+=
instead of
=
Copy code
bacgroundColor += c("red")
which says
Add a background of red
In order to specify more than one value, you can use the
multi
helper function with just a
=
(instead of a
+=
):
Copy code
backgroundColor = multi(c("red"), c("green"), c("blue"))
which says
Set three backgrounds of red, green, and blue respectively
Or, for your specific case:
Copy code
backgroundInsets = multi(box(2.px), box(0.px), box(0.px))