I'm wondering how to add my JPanel image into the JFrame with my current code. I know that I have the Jframe working but I need the Panel to show my image so that then I can set multiple overlapping images in the same JFrame. How do I do this by altering my current code?
import javax.imageio.*;
import javax.swing.*;
import javax.imageio.*;
import java.io.*;
import java.awt.image.BufferedImage;
import java.awt.FlowLayout;
import java.awt.Dimension;
public class Background {
    public Background(JFrame frame) throws IOException{
        BufferedImage castles = ImageIO.read 
        (newFile("C:/Users/dude42/Documents/game/castles.png"));
    JLabel label = new JLabel(); 
    label.setLocation(0,0);
    label.setIcon(new ImageIcon(castles));
    frame.add(label);  
    frame.setVisible(true);
    frame.setSize(1080,1080);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    JPanel pane0 = new JPanel();
    pane0.setPreferredSize(new Dimension(1080, 1080));
    pane0.setLayout(null);
    pane0.add(label,0);
    pane0.setVisible(true);
}
public static void main(String avg[]) throws IOException{
    JFrame frame = new JFrame();
    Background background = new Background(frame);
}
}
 
    