I am trying to add a background image to some window in a javafx application, the image is inside the resources.img package, and css is inside the resources.css package
if I set the background image programmatically, as shown in this thread: Setting the background image using 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 did not find the image file. is it possible to do what i want with css?
The JavaFX CSS parser has a limitation like
@ - Keyword statements are ignored.
"" CSS. , . : -fx-background-image: url("../img/myImage.png");-fx-background-image: url("resources/img/myImage.png");.
-fx-background-image: url("../img/myImage.png");
-fx-background-image: url("resources/img/myImage.png");
, - . : -fx-background-image: url("resources/img/myImage.png");. , .jar , IDE (, Eclipse) . , IDE - : C:/My_project/resources/css/resources/img/myImage.png. , root css .jar package
.jar
C:/My_project/resources/css/resources/img/myImage.png
root