Java、Netbeans:GUI 看起来为何不同?
我是一名 Java/Netbeans 新手,正在学习如何制作 GUI。
我正在关注这个教程,我注意到“成品”产品(其中的第一张图片)链接)看起来不像通过这些步骤构建的 GUI。
这是为什么?我的意思是,当我单击预览按钮时,GUI 看起来也很原生(很好)。只是当它部署时,它看起来很……嗯……很糟糕。哈哈。
有没有办法让最终的 GUI 看起来像原生的?是 Netbeans 设置还是 Java 设置?
注意:我正在 Windows 上开发这个。
I'm a Java/Netbeans newbie learning how to make a GUI.
I was following this tutorial, and I noticed that the "finished" product (first picture in that link) doesn't look like the GUI built through the steps.
Why is that? I mean, when I click on the preview button, the GUI looks native (nice) as well. It's just when it's deployed that it looks all...mmm...bad. lol.
Is there a way to make the finished GUI looks native? Is it Netbeans settings or Java settings?
Note: I'm developing this on Windows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用以下代码强制 swing 选择“系统”外观:
Use the following code to force swing to select the "system" look and feel:
默认的“外观和感觉”是类似金属的,这对于跨平台应用程序来说非常好。
JDK 有 4 个内置的“外观和感觉”(到目前为止),它们是:
您可以在 1 行中尝试任何这些“外观和感觉”,示例代码:
注意:调用/调用此方法来更改“外观和感觉”在任何 GUI 实现之前感觉”,否则可能会抛出一些异常
The default "Look and Feel" is metal-like, which is good and nice for cross-platform applications.
JDK has 4 built-in "look and feel" ('til now), which are:
you can try any of these "look and feel"s in 1 line, example code:
NOTE: invoke/call this method of changing the "look and feel" before any GUI implementation, or it may throw some exception
这称为“外观”。您可以在启动应用程序时或以编程方式使用各种外观和感觉。有关详细信息,请参阅此 Sun 教程。
This is referred to as the "look and feel". You can use various look and feel either when launching your app or programaticaly. See this Sun tutorial for more info.