I am trying to set a file path in a CSS command.
My Main-Class has this path:
/Users/magister/MySnake/src/main/java/SnakeGame.java
Out of this very class I'm trying to use this command:
root.setStyle(""
+ "-fx-background-image: url('/resources/images/gras.png');"
+ "-fx-background-size: 20 20;"
+ "-fx-background-repeat: repeat;"
+ "-fx-border-color: black;"
+ "-fx-border-style: solid;"
+ "-fx-border-width: 2;");
The image gras.png has this path:
/Users/magister/MySnake/src/main/resources/images/gras.png
I've been trying out amounts of alternatives for the path in the css-command/statement. But it hasn't ever been working so far.