Adding a Background Image
You can add a background image to a JFrame by placing a JPanel on the frame then adding the following code which overwrites the paintComponent method to draw an image:
jPanel1 = new JPanel()
{
public void paintComponent(Graphics g) {
super.paintComponent(g);
try {
g.drawImage(ImageIO.read(new File("src/Images/Sunset.jpg")), 0, 0, null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};