Image Icon for URCAP

Hi, I wonder when you create a imageIcon, where do you I place my image that I want in my project

ImageIcon image = new ImageIcon("src/main/java/img/myImage.png");

I like to keep mine in the resources folder:
“YourProject/com.yourCompany.yourProject/src/main/resources/icons/yourImage.png”

Hi,
if you put your image in the “src/main/resources/” folder of your URcap project, then you can easily initialize your ImageIcon as follows:

ImageIcon image = new ImageIcon(getClass().getResource("myImage.png"));
1 Like