Вопрос в Java-программистам
В чем допущена ошибка?
package imagetutorial;
import java.awt.FlowLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class ImageTutorial extends JFrame{
private ImageIcon image;
private JLabel label1;
ImageTutorial() {
setLayout(new FlowLayout());
image=new ImageIcon(getClass().getResource("Example.png "));
label1 = new JLabel(image);
add(label1);
}
public static void main (String args[] ) {
ImageTutorial gui = new ImageTutorial ();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setVisible(true);
gui.pack();
gui.setTitle("This is Images");
}
}
При компиляции Netbeans выбивает такое вот таблo:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.
at imagetutorial.ImageTutorial.
at imagetutorial.ImageTutorial.main(ImageTutorial.java:20)
Java Result: 1