JavaFx imageview can’t resolve file error Code Answer

I’ve been struggling with this problem regarding JavaFx ImageView class. the code written in fxml

  <ImageView fitHeight="634.0" fitWidth="1204.0" layoutX="38.0" layoutY="83.0" pickOnBounds="true" preserveRatio="true" rotate="-8.0">
     <image>
        <Image url="@PCI%20logoRYB.png" />
     </image></ImageView>

and it keeps showing this error

Cannot resolve file 'PCI%20logoRYB.png'

I created all this using scene builder and the image is at the same place as the fxml file/s

Answer

Try remove from your url, like below. Image must be in the resources directory.

<ImageView fitHeight="634.0" fitWidth="1204.0" layoutX="38.0" layoutY="83.0" pickOnBounds="true" preserveRatio="true" rotate="-8.0">
 <image>
    <Image url="@PCI%20logoRYB.png" />
 </image></ImageView>

Related Posts

© No Copyrights, All Questions are retrived from public domain.
Tutorial Guruji