error in java (Javafx): com.sun.javafx.css.StyleManager$ImageCache getCachedImage

655 Views Asked by At

I am having a problem adding an image to my button in javafx.

The program hierarchy is as in the image:

enter image description here

the marks are for the files working with the button

the fxml to create the button are following

<Button fx:id="previos" cacheShape="false" layoutX="149.0" layoutY="416.0" mnemonicParsing="false" prefHeight="45.0" prefWidth="114.0" />

the css for the button is the following

#previos{
    -fx-background-image: url("IconsAndImages/left-arrow-icon.png")
}

I also tried to add the full path:

#previos{
    -fx-background-image: url("1A_Students_Attendance_System_Simple/IconsAndImages/left-arrow-icon.png")
}

but I got the same error

The error I am getting is the following:

Jan 08, 2022 12:12:13 PM com.sun.javafx.css.StyleManager$ImageCache getCachedImage
WARNING: Error loading image: file:/C:/Users/aenas/eclipse-workspace/1A_Students_Attendance_System_Simple/bin/application/1A_Students_Attendance_System_Simple/IconsAndImages/left-arrow-icon.png

I tried the solution in the 3rd comment on this question, but I got the same error

0

There are 0 best solutions below