Where do I store files such as images in a Java project? -
i'm trying access .jpg file use background this:
jlabel label = new jlabel(new imageicon("star_wars.jpg"));;
if change path picture directory on computer has file, works, want give program out, means show on pc. i've tried storing in multiple areas in project itself, , haven't had luck. in source folder called resources. should do?
store relative class file. in example, put image file @ same location class file.
imageicon icon = new imageicon(myclass.class.getresource("star_wars.jpg"));
Comments
Post a Comment