I have an AnchorPane and I want to style it by giving it a BackgroundImage I have in another package :

Here's the CSS I tried:
#body
{
-fx-background-image:url("/Images/FlowersPattern_beige_background.jpg");
}
Using javascript I set the AnchorPane's CSS id to body; that didn't work. I tried to check other questions already asked, but they didn't help. Please can you clarify how, exactly, it should be done?
If your css file is loaded normally, Replacing:
"/Images/FlowersPattern_beige_background.jpg"
with
"../Images/FlowersPattern_beige_background.jpg"
should work.
The path is relative to the css file's directory, the .. accesses the parent directory (src); /Images refers to the Images directory; finally /FlowersPattern_beige_background.jpg accesses your image.
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