Hello I'm trying to make a java game and am trying to upload a picture to test my resizing, however I am unable to load the picture in at all.
ImageIcon img1 = new ImageIcon(this.getClass().getResource("/Pic.png"));
Image im1 = img1.getImage();
public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(im1, 0, 0, null);
}
I have my png file inside the package that my class is in but I get a null pointer exception on the line where I try to use getResource(). Any help is appreciated thanks in advance.