I need some help with importing Images to my JavaFx application:
My image has the path : /sprinter/ExternalSprinterFolder/Maps/map_asteroid/map_asteroid.jpg
My GUI code has the path: /sprinter/src/de/sprinter/gameclient/gui/SelectSectorGui.java
I tried already a lot but I can't load the image... I tried for example:
File file = new File(imagePath);
Image image = new Image(file.toURI().toString());
ImageView iv = new ImageView(image);
and
String image = SelectSectorGui.class.getResource(imagePath).toExternalForm();
pane.setStyle(("-fx-background-image: url(\" " + image +
" \");-fx-background-repeat: no-repeat;"));