Original Post
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class View extends JFrame
{
JPanel jp = new JPanel();
JLabel jl1 = new JLabel();
ImageIcon figure = new ImageIcon(getClass().getResource("/blank.png")); // I get the exception here
public View(){
setTitle("test");
setSize(800, 600);
setResizable(false);
setVisible(true);
setLocationRelativeTo(null);
jl1.setIcon(figure);
jp.add(jl1);
add(jp);
jl1.setBounds(0, 0, jl1.getIcon().getIconWidth(), jl1.getIcon()
.getIconHeight());
validate();
}
public static void main(String[] args){
new View();
}
}for some reason I can
t fetch the image and the path and name is correct checked it several times
and the funny thing is Im doing it by checking some old code of mine and there is working perfectly ...This is the exception I get any Ideas ?
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.
at View.
at View.main(View.java:30)