JPanel on top of JLabel

Posted by newbie on Stack Overflow See other posts from Stack Overflow or by newbie
Published on 2011-02-22T14:38:00Z Indexed on 2011/02/22 15:25 UTC
Read the original article Hit count: 325

Filed under:
|
|
|

Good day!

Is it possible to add a JPanel on top of a JLabel?

I would like my JFrame to have a background image and in order to this, i used this code (based from past stackoverflow answers):

 setLocation(150,50);
 setSize(700,650);
 setVisible(true);
 JLabel contentPane = new JLabel();
 contentPane.setIcon(new ImageIcon("pics/b1.jpg"));
 contentPane.setLayout( new BorderLayout());
 setContentPane( contentPane );

Now my problem is, I cannot put a panel on my JFrame because of the JLabel background. Please help.

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about swing