I'm learning java by watching tutorials, I'm a beginner. Currently, I'm trying to follow a tutorial (https://www.youtube.com/watch?v=_SqnzvJuKiA) to make the snake game. Around minute 11, the man makes a jpg display on the window. I believe I followed all of his steps but can't seem to make it work. Iv'e attached following image of my code and output
and paste "my" code.In the public void paint line netbeans tells me to "add @override annotation", which he didn't do, and "multiple annotations here [2] click to cycle".
In the output on the top white rectangle should appear the jpg.
Does someone see my mistake?
package snake;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class GP extends JPanel{
private ImageIcon titleImage;
public GP() {
}
public void paint(Graphics g)
{
// Titulo
g.setColor(Color.white);
g.drawRect(24, 10, 851, 55);
titleImage = new ImageIcon("snaketitle.jpg");
//ImageIcon icon = new ImageIcon("androidBook.jpg");
titleImage.paintIcon(this, g, 25, 11);
//Area Juego
g.setColor(Color.WHITE);
g.drawRect(24,74,851,577);
g.setColor(Color.black);
g.fillRect(25,75,850,575);
}