I\'m trying to set an image as the background using this code:
root.setStyle(\"-fx-background-image: url(\'splash.jpg\'); -fx-background-posi
Try next:
String image = JavaFXApplication9.class.getResource("splash.jpg").toExternalForm(); root.setStyle("-fx-background-image: url('" + image + "'); " + "-fx-background-position: center center; " + "-fx-background-repeat: stretch;");