import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.swing.JPanel; public class BackgroundPanel extends JPanel{ BufferedImage backgroundImage; GUIFrame window = null; public BackgroundPanel(BufferedImage image, GUIFrame windowFrame){ backgroundImage = image; window = windowFrame; } @Override public void paintComponent(Graphics g){ super.paintComponents(g); this.setVisible(true); g.drawImage(backgroundImage, 0, 0, window.getWidth(), window.getHeight(), null); } }