I’m a complete noob to Java 2d but perhaps you can help me out. I’m trying to test drawing an image to a panel. My does nothing. I’ve tested this same method with drawstring and it works fine.
@Override
public void paintComponent(Graphics g) {
BufferedImage temp = null;
try {
temp = ImageIO.read(new File("/res/image/girls.JPG"));
} catch (IOException e)
{
//catch exception
}
super.paintComponent(g);
g.drawImage(temp, 0, 0, ViewPort.this);
}
Works fine when I use graphics to draw text and shapes. I double checked my image location. Any help would be nice.