I have a small JavaFX app. Everything looked fine, and was working fine. Suddently, I wanted to convert this project to a Maven project (I wanted to add some external dependencies and use them in the app).
In Eclipse I have right-clicked the project, selected Configure
and then Convert to Maven project...
. Everything went fine, until I have build and run the application. The whole app is working perfectly, but there was a logo in the app window, and after converting the project to Maven - the image has dissapeared.
I am using JavaFX with FXML and SceneBuilder.
In the RootLayout.fxml
file, there is an entry:
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="225.0" layoutY="50.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../../../../../resources/images/nbtc.jpg" />
</image>
</ImageView>
It is still visible in SceneBuilder
after conversion to Maven, but it has disappeared from the app after running it.
Here is the folder structure:
Funny thing is, that the programicon32.png is working correctly and it is shown in the application. But it is defined in another place, outside the FXML file:
@Override
public void start(Stage primaryStage) {
...
this.primaryStage.getIcons().add(new Image("file:resources/images/programicon32.png"));
initRootLayout();
...
}
EDIT:
I have moved the image to the same package where RootLayout.fxml
is, and have selected the moved image in SceneBuilder
, the image is showing now, but still, this is not the droid that i'm looking for...