简体   繁体   中英

Adding a component to jpanel in netbeans

I have been trying for the past few hours to figure out how to add a label component to a window however with no prevail. I have created a new desktop application project in Netbeans and it comes with pre-generated code. I want to add a label to it but it just does not show?. I am unsure as to why because i am following the normal panel.add(component) convention.

Would really appreciate some help!. I pasted the full file sourecode here http://pastebin.com/qJk6bSWn .

Any ideas?

What layout is your JPanel using? If it's using the Netbeans GUI builder default of free design you won't be able to manually add components. You'll need to set it to some layout manager.

Parts of your gui can have the Free Design layout, but you'll need to change the layout of the components that you want to manually add to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM