好吧,我正在尝试设置我的图标图像,但我不断收到此错误....
代码:
public static void browser(){
Image myicon = null;
myicon.equals("images/icon.gif");
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (UnsupportedLookAndFeelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
JFrame frame = new JFrame("Kloke - Become invisable.");
frame.setSize(350, 100);
frame.setResizable(false);
frame.setIconImage(myicon);
错误:
Exception in thread "main" java.lang.NullPointerException
at web.browser(web.java:14)
at Checkupdate.main(Checkupdate.java:102)
PS。我是 java 新手,所以请随意对待我,就好像我不知道自己在做什么一样(PSS 第 14 行是我初始化“myicon”变量的地方。)