Java IDE (NetBeans) 的奇怪行为
我正在使用 Java 和 NetBeans 创建一个应用程序,在使用编辑器创建和更改 GUI 时,我似乎得到了一些不同的结果。
我在编辑器中的设计如下所示:
当我单击该图标时,会向我演示它的效果实际上看起来像我看到的:
请注意,GUI 右侧的面板已向下移动并推送文本结果框下来。
现在,当我运行应用程序本身时,我看到了:
我可能太习惯了Visual Studio IDE 的工作原理是,所有内容通常都保留在您放置的位置,我是否缺少某种隐藏的技巧或属性,导致所有内容都丢失?
感谢您抽出时间。
编辑:
组件代码 - http://pastebin.com/FHF2fBEw
I'm using Java and NetBeans to create an application and I seem to be getting some varying results when it comes to making and changing the GUI using the editor.
My design in the editor looks like this:
When I click on the icon to give me a demonstration of what it would actually look like I see this:
Notice that the panel to the right of the GUI has moved down and pushed the text box down as a result.
Now when I come to run the application itself I see this:
I may be too used to the way in which the Visual Studio IDE works in the fact that everything generally stays where you put it, am I missing some sort of hidden trick or property that is throwing everything off?
Thanks for your time.
Edit:
Code for the components - http://pastebin.com/FHF2fBEw
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前遇到过此类问题,视觉设计器(本例中为
Matisse
)并不总是在不同的窗口分辨率下给出相同的结果。在与您现在遇到的几个问题进行斗争之后,我决定使用 JGoodies Forms。如果您想在没有大量代码的情况下控制 GUI,我建议您使用它。
I had this kind of problems before, not always the visual designer (
Matisse
in this case) gives you the same result at different window resolutions. After fighting with several issues like the one you are having now, I decided to use JGoodies Forms.I would suggest you to use it if you want to have control over your GUIs without a lot of code.
您使用哪种布局?我建议为您正在做的事情使用
java.awt.GridBag
布局。What kind of layout are you using? I suggest a
java.awt.GridBag
layout for what you're doing.