When i’m using an image in my FXML code like this…
<Image url="@/de/myprj/assets/icons/arrow.png" />
…everything goes fine until the moment when i want to edit the FXML file in SceneBuilder. How can i use such resources within FXML with SceneBuilder?
It is far safer to set the image using CSS, either in scene builder or preferably in a stylesheet specific to your app.
Checkout: http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#imageview
edit:
Create a css file, load it into the scene’s css files when you start your application.
In your CSS file add the following:
Make sure there is a file called theimage.png in the same directory as your css file. In scenebuilder, click on the ImageView. In the box that is labeled “Style Class” add the string the-image.
Voila.