简体   繁体   English

使用哪一个:用于GNOME桌面应用程序的Java Swing或GTK +?

[英]Which one to use: Java Swing or GTK+ for GNOME desktop application?

I am considering developing a GNOME desktop application with a graphical user interface. 我正在考虑使用图形用户界面开发GNOME桌面应用程序。 I know GTK+ is the first choice, especially when developing for the GNOME environment. 我知道GTK +是首选,特别是在为GNOME环境开发时。 End users also consider GTK+ as the first choice for applications they use. 最终用户还将GTK +视为他们使用的应用程序的首选。 I am, however, considering future improvements: what if my application will need a port to another environments or OS like KDE or Mac or Windows? 但是,我正在考虑未来的改进:如果我的应用程序需要一个端口到另一个环境或操作系统,如KDE或Mac或Windows,该怎么办? Which is the best way to go: Java Swing (because it's platform independent) or GTK+? 哪种方式最好:Java Swing(因为它独立于平台)或GTK +?

Use GTK+. 使用GTK +。 It's available for Windows as well if you ever do want to port it, and integrates infinitely much better with gnome. 它也适用于Windows,如果你想要移植它,并与gnome无限集成。

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI( this );

On *nix variants, that should produce the GTK PLAF in Swing. 在* nix变种上,应该在Swing中生成GTK PLAF。 On Apple(1) it will probably produce a theme with 'Aqua' in the name, and on Windows(1) it will be something like 'Windows'. 在Apple(1)上,它可能会在名称中生成一个名为“Aqua”的主题,在Windows(1)上它将类似于“Windows”。

1) I doubt that Windows or Apple users want to see a 'GTK look' app. 1)我怀疑Windows或Apple用户是否希望看到“GTK外观”应用。 on their desk-top. 在他们的桌面上。 ;) ;)

My users generally prefer Swing, but GTK applications are only slightly more difficult to maintain cross-platform. 我的用户通常更喜欢Swing,但GTK应用程序只是稍微难以维护跨平台。

GTK doesn't run natively on Mac OS X; GTK不能在Mac OS X上本机运行;

GTK and its dependencies can be built using MacPorts , and popular open source tools such as Gimp and Inkscape include the required libraries in the application bundle. GTK及其依赖项可以使用MacPorts构建,而流行的开源工具(如GimpInkscape)包含应用程序包中所需的库。

it requires to install an X server. 它需要安装X服务器。

X11 for Mac is "fully integrated with Mac OS X." X11 for Mac “与Mac OS X完全集成”。

Addendum: As @ptomato notes, the portfile offers both Quartz and X11 variants. 附录:正如@ptomato所说, portfile提供了Quartz和X11两种变体。

The answer depends on what you actually want. 答案取决于你真正想要的。

GTK library is native in the Gnome environment: if you want to develop an application thought for Gnome, use GTK. GTK库在Gnome环境中是原生的:如果你想为Gnome开发一个应用程序思想,请使用GTK。

If you are not so much interested in giving a native feel to the Gnome users then use whatever you want (GTK, Swing, Qt, wx ...). 如果你对Gnome用户没那么感兴趣,那么就可以使用你想要的任何东西(GTK,Swing,Qt,wx ......)。


By the way if you want my personal opinion, I prefer GTK a lot. 顺便说一句,如果你想要我个人意见,我更喜欢GTK。 I personally don't like Swing, especially when it tries to emulate GTK look and feel. 我个人不喜欢Swing,特别是当它试图模仿GTK的外观和感觉时。

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

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