I have been trying to create a resizable image by drawing BufferedImage on a panel and redrawing it whenever componentResized happened. However, despite the image loading fine in earlier versions (which either didn't resize at all or didn't do it properly) now Java claims the image isn't there. The code is as follows
public class Image extends JPanel{
BufferedImage img=null;
public Image{
try {
img = ImageIO.read(new File("Untitled.png"));
}
catch (IOException e) {
}
Dimension d=getSize();
Graphics g=getGraphics();
g.drawImage(img, 0, 0, d.width, d.height, null);
even without the component listener, it returns NullPointerException on drawImage. But I know the image isn't null, since it worked previously, which leads me to thinking there's something wrong with the code here