I'm trying to make an application to manage some drink recipes...
I need to show the drink image in a JPanel
already working with the file path like this:
ImageIcon image = new ImageIcon("src/fotos/trinidad.jpg");
The problem is that when I try to set this path setting it with the object name, the image is not being loaded.
String s = ("src/fotos/"+b.getNome().toLowerCase()+".jpg");
ImageIcon image = new ImageIcon(s);
Printing this string s
I have this result:
System.out.println(s);
src/fotos/trinidad.jpg
Apparently it looks the same path, but the image is not being loaded. What am I doing wrong?