简体   繁体   English

我应该将什么样的Swing外观用于Java桌面应用程序?

[英]What Swing look and feel should I use for a Java desktop application?

I am developing a Java desktop application and I use Swing to build the GUI. 我正在开发一个Java桌面应用程序,我使用Swing来构建GUI。 I realize that I can change the look of my app by setting different L&Fs. 我意识到我可以通过设置不同的L&F来改变我的应用程序的外观。

The JRE (from SUN) provides me at least two L&Fs, one is the default Metal L&F and the other is the "System" L&F which let my app have a native look. JRE(来自SUN)为我提供了至少两个L&F,一个是默认的Metal L&F,另一个是“System”L&F,它让我的应用具有原生外观。 Also I can find some really cool L&Fs on the internet. 我也可以在互联网上找到一些非常酷的L&F。

The question is: which L&F should I use for my desktop app? 问题是:我应该将哪些L&F用于我的桌面应用程序? Someone said the native look will be more user friendly, is that true? 有人说原生外观会更加用户友好,是真的吗? If I use the system L&F, should I make different versions of my user handbook (since the UI will change according to the OS)? 如果我使用系统L&F,我应该制作不同版本的用户手册(因为UI会根据操作系统而改变)吗?

Unless you're trying for a completely custom look for your app, I'd recommend the System L&F. 除非您尝试完全自定义外观,否则我建议使用系统L&F。 It does make your application a little easier to use by making it similar in appearance to other applications on the platform, which the user will presumably be familiar with. 它确实使您的应用程序更容易使用,使其在外观上与平台上的其他应用程序类似,用户可能会熟悉这些应用程序。

I'd definitely stay away from the Metal L&F. 我肯定会远离金属L&F。 Nothing screams "Java in the late 90's" like that ugly gray chrome. 没有什么能像“丑陋的灰色铬”那样尖叫“90年代后期的Java”。 (Unless that retro look is actually what you're going for.) (除非是复古的外观实际上是你什么。)

If you have enough users on different systems to warrant testing the UI on those systems, it wouldn't hurt to grab the screen shots for your user manual on multiple systems either. 如果您在不同系统上有足够的用户来保证在这些系统上测试用户界面,那么在多个系统上抓取用户手册的屏幕截图也不会有什么坏处。 If you're making a print copy you might want to just show the most common platform, but electronic copies could be customized for each OS you've tested for. 如果您正在制作打印副本,您可能只想显示最常用的平台,但可以为您测试过的每个操作系统自定义电子副本。

I guess you don't mean to find the best look and feel, you are inclined to use the system look and feel but don't want to invest more workload on documentation for all platforms. 我想你并不是要找到最好的外观和感觉,你倾向于使用系统的外观和感觉,但不想在所有平台的文档上投入更多的工作量。

Actually you can pick a decent look and feel, like nimbus or something else as the default skin, and allow your users to choose the "skin" in the preference settings. 实际上你可以选择一个像样的外观和感觉,如灵气或其他东西作为默认皮肤,并允许您的用户在首选项设置中选择“皮肤”。 Thus your document can just include the screenshots for the default skin. 因此,您的文档可以包含默认皮肤的屏幕截图。

While you do have total flexibility -- the PLAF or pluggable-look-and-feel framework is, well, pluggable -- many developers believe that users will feel that an app is weird is awkward if it doesn't look like other apps on the their operating system. 虽然你确实具有完全的灵活性 - PLAF或可插拔外观框架是可插拔的 - 许多开发人员认为,如果应用程序看起来不像其他应用程序那么奇怪是一件很奇怪的事情他们的操作系统。 To this point, Swing has an OSX look and feel that only runs on OSX, and I think the converse is true for Windows. 到目前为止,Swing的OSX外观和感觉只能在OSX上运行,我认为对Windows来说也是如此。

While it depends on your audience, of course, Swing apps made for commercial appeal generally try to use the native look and feel. 当然,这取决于您的受众,为商业吸引力而设计的Swing应用程序通常会尝试使用原生外观。

Note: On OSX, some standard OSX things like having the Quit for your app under the apple menu (and not under the file menu, like on Windows) is ONLY available in their look and feel. 注意:在OSX上,一些标准的OSX操作,例如在Apple菜单下为您的应用程序退出(而不是在Windows下的文件菜单下),它们的外观和感觉都是可用的。

Edit: For an app to be truly cross-platform, you would have to have a separate manual for different platforms if you use the native look and feel. 编辑:要使应用程序真正实现跨平台,如果您使用本机外观,则必须为不同平台配备单独的手册。 That might be a good reason to avoid it and choose one you like, like Metal. 这可能是避免它并选择你喜欢的一个的好理由,比如Metal。

If cross-platformness is important for you then I'd go with nimbus (which is quite pretty unlike metal). 如果跨平台对你很重要,那么我会选择nimbus(这与金属非常不同)。 An app that looks native will just confuse users unless it behaves exactly like a native app. 看起来像本机的应用程序只会让用户感到困惑,除非它的行为与本机应用程序完全相同。

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

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