how to add a background to a jpanel
<p>I would like to add a jlabel to a jpanel I've used this code</p>

<pre><code>JLabel background=new JLabel(new ImageIcon("Myimage.jpg"));
panel.add(background);
frame.setContentPane(panel);
</code></pre>

<p>the image is sized with the minimized window not the maximized one, so when I maximize the window it shows an empty space which I don't want. I would like a background for the jpanel I added</p>