I want to set icon to my JFrame. I do the following:
Image icon = Toolkit.getDefaultToolkit().getImage(\"src/images/icon.jpg\"); this.setIconImage(icon);
You can simply create a package inside the main source, and incluse your images in this package. Then, just call the images in your main class like:
ImageIcon a = new ImageIcon(MainClass.class.getResource("/Package/Image.jpg"));