I am trying to write a retro snake game. I set a background image of an old Nokia, and I want to play the snake from its screen. However, I cannot put my gamepanel on my background image. Can I do that? I used this code for my background image.
Thanks.
JFrame frame = new JFrame("Retro Snake");
frame.getContentPane().add(new GamePanel());
try {
frame.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("Images\\background.jpg")))));
} catch (IOException e) {
e.printStackTrace();
}
frame.setLocation(500, 100);
frame.pack();
frame.setVisible(true);