简体   繁体   中英

adding image to my project doesn't work in fxml

As part of the java masterclass course in the javafx section there was a tutorial on how to add images to the program. I followed everything that the tutor did and it didn't work, I tried multiple times yet I got errors every time:

enter image description here this is my code and the error (I sent an image because the code isn't the problem its the source code that he wrote). I use the Java Look and Feel Graphics Repository 1.0 for the images.

I followed the steps in the course and I was expecting the program to load and have a button and a label with an image next to them. I got a long list of errors that I dont understand how to use them. intellij says that "it cannot resolve directory every directory that I try ".

From the Log terminal if you observe you can note that it hints on the directory or location of the image that you are using in the fxml. It is advisable to always place all your icons or images in the resources folder and ensure that the "resources dir" is marked as a resource folder so that you can easily access the directory content in the fxml file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM