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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -