简体   繁体   English

JPanel遍及JFrame

[英]JPanel spreads over JFrame

I am designing my GUI in netbeans IDE editor. 我正在netbeans IDE编辑器中设计我的GUI。 In editor i placed JPanel into JFrame . 在编辑器中,我将JPanel放入JFrame In code I have: 在代码中,我有:

setContentPane(jPanel1);

after this, jPanel1 is spreaded over JFrame . 之后,将jPanel1扩展到JFrame

How can I position the JPanel , best with layouts, so it does not spread and overlay other components? 如何最好地将JPanel在布局上,以使其不会展开和覆盖其他组件?

To prevent overlaying just add other componets after you set contentPane to JFrame. 为防止覆盖,只需将contentPane设置为JFrame 之后添加其他组件。 More precisely jpanel1 does not overlay other components, it substitutes the old content panel, containing your components. 更准确地说,jpanel1不会覆盖其他组件,它替代了包含您的组件的旧内容面板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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