开发者

Add a component into Jframe or JLabel created by Netbeans

开发者 https://www.devze.com 2022-12-15 16:54 出处:网络
I\'m using Netbeans. I use Netbeans to create a Jframe and drag and drop a JLabel to Jframe. I want to add a JLinkButton (I use zfqjava JLinkbutoon) to Jframe and to JLable by using code(but not dra

I'm using Netbeans.

I use Netbeans to create a Jframe and drag and drop a JLabel to Jframe.

I want to add a JLinkButton (I use zfqjava JLinkbutoon) to Jframe and to JLable by using code(but not drap and drop) but it doesn't work.

Here is my code to add JLinkButton to JFrame

 this.getContentPane().add(linkButton);

and here is 开发者_Python百科my code to add JLinkButton to JLabel

 lblbackground.add(linkButton);


You can't add the same JLinkButton both places. It will only appear in the last place you add it. Instead create to instances of it, one for each place you want to put it.

0

精彩评论

暂无评论...
验证码 换一张
取 消