在netbeans中将组件添加到jpanel [英] Adding a component to jpanel in netbeans

查看:140
本文介绍了在netbeans中将组件添加到jpanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几个小时我一直在努力弄清楚如何将标签组件添加到窗口中,但不占优势。我在Netbeans中创建了一个新的桌面应用程序项目,它带有预生成的代码。我想给它添加一个标签,但它没有显示?我不确定为什么因为我遵循正常的panel.add(组件)约定。

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.

非常感谢一些帮助!我在这里粘贴了完整的文件sourecode http://pastebin.com/qJk6bSWn

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

任何想法?

推荐答案

您的JPanel使用什么布局?如果它使用Netbeans GUI构建器默认的免费设计,您将无法手动添加组件。您需要将其设置为某个布局管理器。

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.

gui的部分内容可以采用Free Design布局,但您需要更改要手动添加的组件的布局。

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.

这篇关于在netbeans中将组件添加到jpanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆