我正在 netbeans 中开发一个 java 应用程序,以保存图像图标,我应该创建一个新的图像文件夹还是已经创建了一个图像文件夹?
我在项目中创建了一个图像文件夹,将图像图标设置为 JFrame,
URL iconURL = this.getClass().getResource("images/images.jpg");
ImageIcon icon = new ImageIcon(iconURL);
frame.setIconImage(icon.getImage());
错误
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:115)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:125)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:263)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:205)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169)