简体   繁体   English

使用Netbeans GUI Swing Builder的JComponents位置

[英]Position of JComponents using Netbeans GUI Swing Builder

I'm developing a graphic interface using Java and Swing, and I'm having a hard time getting the JButtons to stay in their position while changing from one panel to another. 我正在使用Java和Swing开发图形界面,并且很难让JButton在从一个面板切换到另一个面板时保持其位置不变。

There are three buttons in a row aligned in the left bottom of each panel, all the panels the same size, but somehow they manage to change their position a little when I run the application (on the design preview they show up in the right place). 在每个面板的左下方连续排列了三个按钮,所有面板的尺寸均相同,但是当我运行应用程序时,它们设法以某种方式改变了位置(在设计预览中,它们显示在正确的位置)。 It's getting a bit annoying. 有点烦人。 I'd appreciate any help 我将不胜感激

Are you trying to do tabs? 您是否要制作标签? If you are, a JTabbedPane will do this much better than a button. 如果您是,那么JTabbedPane会比按钮做得更好。

Since you are using the Netbeans GUI Builder, look at the options in the Component panel on the left. 由于您使用的是Netbeans GUI Builder,因此请查看左侧“组件”面板中的选项。 It has Swing tabbed panes and AWT panes if you really want. 如果您确实需要,它具有Swing选项卡式窗格和AWT窗格。

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

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