public class Intro extends JFrame implements ActionListener {
ImageIcon pic = new ImageIcon(this.getClass().getResource("cars-games.jpg"));
JLabel l1 = new JLabel();
Image car = pic.getImage();
public static void main (String[]args){
Intro i = new Intro();
i.show();
}
}
它给我这个错误:异常螺纹
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at Intro.<init>(Intro.java:15)
at Intro.main(Intro.java:58)
谁能帮助PLZ。
哪一行是第58行? – Xymostech
这是第58行吗? –
介绍i = new Intro(); –