Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX usage of "in jar" images in css

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?

like image 400
bennyl Avatar asked May 11 '12 12:05

bennyl


1 Answers

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");.

like image 101
Uluk Biy Avatar answered Oct 12 '22 23:10

Uluk Biy