java 有人可以推荐Java Swing的替代品吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4462053/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can someone please recommend an alternative to Java swing?
提问by james
I have been mucking about with Java swing lately but it's butt ugly! Are most people who write Java GUI's using swing or something else? I would really appreciate a recommendation. I don't want to use a GUI builder because I need to learn how everything works first.
我最近一直在忙于 Java Swing,但它的屁股很难看!大多数编写 Java GUI 的人是使用 Swing 还是其他东西?我真的很感激推荐。我不想使用 GUI 构建器,因为我需要先了解一切是如何工作的。
Thanks!
谢谢!
采纳答案by J-16 SDiZ
Most people use Swing.
大多数人使用 Swing。
Some use SWT, but you have to dispose object after use. (no auto dispose in Garbage collecting) It give very native look UI.
有些使用SWT,但您必须在使用后处理对象。(在垃圾收集中没有自动处理)它提供了非常原生的 UI。
Some use Qt-Jambi, but then you have to understand some C++ code. Most of them are for interoperating with Qt.
有些使用Qt-Jambi,但是您必须了解一些 C++ 代码。其中大部分用于与 Qt 互操作。
Some ancient code use AWT. Most of them are for legacy reason. I recommend avoid it.
一些古老的代码使用 AWT。他们中的大多数是出于遗留原因。我建议避免它。
回答by Olivier Croisier
If you don't like the default Swing look'n'feel, you can change it ; many ready-built themes exist. And it is quite possible to build beautiful and ergonomic applications with Swing : take a look at Netbeans or IntelliJ.
如果您不喜欢默认的 Swing 外观,可以更改它;存在许多现成的主题。并且很有可能使用 Swing 构建美观且符合人体工程学的应用程序:看看 Netbeans 或 IntelliJ。
But if you definitely want to use another graphic toolkit, you can try SWT. Contrary to Swing that is pure Java, SWT uses native controls as much as possible (those provided by your OS), and emulates the missing ones. It was developed for, and is used by, the Eclipse platform.
但是,如果您确实想使用其他图形工具包,则可以尝试 SWT。与纯 Java 的 Swing 相反,SWT 尽可能多地使用本机控件(由您的操作系统提供的控件),并模拟缺少的控件。它是为 Eclipse 平台开发并由其使用的。
回答by Mud
I have been mucking about with Java swing lately but it's butt ugly!
我最近一直在忙于 Java Swing,但它的屁股很难看!
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
Are most people who write Java GUI's using swing
大多数人使用 Swing 编写 Java GUI 吗?
For most things, yes. It's built-in, and doesn't suck that bad for a cross-platform GUI library (which all suck to some extent).
对于大多数事情,是的。它是内置的,对于跨平台的 GUI 库来说并没有那么糟糕(这在某种程度上都很糟糕)。
回答by Bozho
- SWT
- Spring-RCP(ontop of swing)
- 声波
- Spring-RCP(在秋千上)
By the way, Swing's Look and Feel can be customized. There are some pretty good LaFs. See herehow to change the look and feel.
顺便说一下,Swing 的外观和感觉是可以定制的。有一些非常好的 LaF。在此处查看如何更改外观。
Check this questionfor how to change the look and feel and for a list of nice look and feels
检查此问题以了解如何更改外观以及外观和感觉的列表
回答by bezmax
SWT is very good. It tries to use native GUI drawing functions wherever possible. An example of application written with SWT is Eclipse IDE.
SWT 非常好。它尽可能地尝试使用本机 GUI 绘图功能。使用 SWT 编写的应用程序示例是 Eclipse IDE。
回答by yohann.martineau
you can use native look and feel with swing, thus it's less ugly. Personnally, I use swing for my GUIs in java, and I find it quite straight forward and documented.
您可以使用带有摆动的原生外观,因此它不那么难看。就我个人而言,我在 Java 中为我的 GUI 使用了 Swing,并且我发现它非常简单并且有文档记录。
Here is a link toward swing documentation:
这是一个指向摆动文档的链接:
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
回答by NullPointer
The only thing is ugly in Swing is standart layout manages. They are or too primitive or too complicated. If you really want to write nice gui without gui builders take a look at alternative layout managers. For example Table layout https://tablelayout.dev.java.net/
Swing 中唯一难看的是标准布局管理。它们或太原始或太复杂。如果您真的想在没有 gui 构建器的情况下编写漂亮的 gui,请查看替代布局管理器。例如表格布局https://tablelayout.dev.java.net/
回答by Barmaley Red Star
Look to SWT http://www.eclipse.org/swt/- Eclipse entirely built on it.
看看 SWT http://www.eclipse.org/swt/- Eclipse 完全建立在它之上。