I\'m trying to implement a very simple interface to Raspberry Pi in JavaFX. I\'m using an .fxml based layout and styling my items with css. My problem is despite the app works p
The problem with your project is in the resources folder. Being outside the source folder is not found.
This is how I made it work:
Created a JavaFX project in NetBeans, and moved the resource folder inside the source one. So this is Source Packages:
-Source Packages
+me.noip.blase
+me.noip.blase.view
+resources.images
and then changed all references from file:
to "/":
primaryStage.getIcons().add(new Image("/resources/images/icon.png"));
and the css file:
.imageButton1 {
-fx-background-color: blue;
-fx-graphic: url('/resources/images/temperature.png');
}
.imageButton2 {
-fx-graphic: url('/resources/images/gear.png');
-fx-background-color: red;
}
.imageButton3 {
-fx-graphic: url('/resources/images/power.png');
-fx-background-color: black;
}
.imageButton4 {
-fx-graphic: url('/resources/images/diagram.png');
-fx-background-color: green;
}
Now it works fine in both desktop and Raspberry Pi.
I will accept your solution as an answer, I tried importing to NetBeans and it worked, but I cannot reproduce that under Eclipse. Meanwhile I found another question here and followed that solution and it works(I dont know how I didn't find that before, I massively googled for a day)
I will leave this here if anyone else searchs for this.
Thank you very much for your time and help :)