Add a component into Jframe or JLabel created by Netbeans
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.
精彩评论