0
画像、https://spooker.cc/spooker3.pngのBufferedImage /イメージアイコンNULLポインタ例外
コード:
private JLabel getSpookerImage() {
URL url;
try {
url = new URL("http://spooker.cc/spooker3.png");
BufferedImage image = ImageIO.read(url);
ImageIcon icon = new ImageIcon(image);
return new JLabel(icon, JLabel.CENTER);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
が例外:おそらく
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:240)
at cc.spooker.ui.tabs.MainTab.getSpookerImage(MainTab.java:63)
at cc.spooker.ui.tabs.MainTab.getDestructPanel(MainTab.java:53)
at cc.spooker.ui.tabs.MainTab.<init>(MainTab.java:35)
at cc.spooker.ui.Frame.<init>(Frame.java:35)
at cc.spooker.Server.<init>(Server.java:21)
at cc.spooker.Main.main(Main.java:8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
画像は空白の背景を持っているので?手掛かりではありません。
どの行が 'Exception'を生成しますか? –
彼はスタックトレースを掲示しました。 –
@AlexR私が知っているのは、どの行が "63' –