I am trying to add background image to some pane in my javafx application, the image is located inside the package resources.img and the css is located inside the package resources.css
if i setting the background image programmatically like suggested in this thread: Setting background image by javafx code (not css)
it works fine but i would like to know if i can set the background image from the css file itself.
i tried
-fx-background-image: url("@../img/myImage.png");
but then the css interpreter didn't find the image file. is it possible to do what i want via css?
JavaFX CSS parser has a limitation like
@-keyword statements are ignored.
described in "Limitations" section of CSS Reference Guide. It may be the cause of your problem though didn't confirm myself. Can you try like this: -fx-background-image: url("../img/myImage.png");
or -fx-background-image: url("resources/img/myImage.png");
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With