How to put JButton on jlabel?

I am using the NetBeans ide to create applications in Java swing In my application, I put multiple jinternalframes on the jdesktoppane I put jlabel on the jinternalframe I set image in jlabel

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/myImage.jpg")));

Now I want to be in that label Add JButton. So

How to put JButton on jlabel (including image) in Java swing?

Sorry for being late What I want to do is in the picture below

Before the image

After image I want it here

Solution

Although it sounds like you can simply process the image as an imageicon object and bind it to JButton, you can change the Z index of the two components Here is the document

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>