java 如果 Swing 已弃用,有什么替代方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5828625/
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
If Swing is deprecated, what is the alternative?
提问by Dean
I heard that apparently Swing is being developed no longer. I like Swing and use it all the time.
我听说显然不再开发 Swing。我喜欢 Swing 并一直使用它。
What should I now be using instead?
我现在应该用什么代替?
回答by Harry Joy
回答by Andrew Thompson
You probably read something about the 'Swing Application Framework', which while built usingSwing, is not 'Swing'.
您可能阅读过有关“Swing 应用程序框架”的内容,虽然它是使用Swing构建的,但它不是“Swing”。
From Swing Application Framework - Status and Roadmap.
Development on an open source Reference Implementation called appframework was begun in 2006.[1] It was originally expected that this implementation would be the means for integrating JSR 296 into the upcoming Java SE 7 (Dolphin) version of the Java programming language, and the project was scheduled to be included in milestone 5 of the JDK7 development. However, in August 2009, it was announced that the project would not be included due to an inability to reconcile design flaws and achieve consensus among the JSR 296 team before the milestone 5 deadline.[2]
The original Swing Application Framework implementation has been put on hold indefinitely.[3] The last public release of the appframework project is version 1.03.[1]
2006 年开始开发名为 appframework 的开源参考实现。[1] 最初预计此实现将成为将 JSR 296 集成到即将推出的 Java SE 7 (Dolphin) 版本的 Java 编程语言的手段,并且该项目计划包含在 JDK7 开发的里程碑 5 中。然而,在 2009 年 8 月,由于无法在里程碑 5 截止日期之前协调设计缺陷并在 JSR 296 团队之间达成共识,该项目将不会被包括在内。 [2]
最初的 Swing 应用程序框架实现已无限期搁置。 [3] appframework 项目的最后一个公开版本是 1.03 版。[1]
回答by Christian Duvall
Older question, but worth a reference:
较旧的问题,但值得参考:
Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and therefore included in the JRE. While we recommend > developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to extend a Swing application with JavaFX, allowing for a smoother transition.
JavaFX 是否正在取代 Swing 作为 Java SE 的新客户端 UI 库?
是的。但是,在可预见的未来,Swing 仍将是 Java SE 规范的一部分,因此包含在 JRE 中。虽然我们建议开发人员在构建新应用程序时尽可能多地利用 JavaFX API,但可以使用 JavaFX 扩展 Swing 应用程序,从而实现更平滑的过渡。
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
回答by gagarwa
Jan 2019 Latest
2019 年 1 月最新
For reference, AWT & Swing have been moved to java.desktopsince Java SE 9. You can watch for future changes here. JavaFX(added to JDK since 8) was removed from the official JDK in Java 11. So its hard to say what is "official" anymore. However JavaFX's development has increasedsince the decoupling, with its new home here.
作为参考,从 Java SE 9开始,AWT 和 Swing 已移至java.desktop。您可以在此处查看未来的更改。 JavaFX(从 8 开始添加到 JDK)在 Java 11 中从官方 JDK 中删除。因此很难再说什么是“官方”。然而,JavaFX 的发展自解耦以来有所增加,它的新家在这里。
回答by Ignacio Vazquez-Abrams
回答by tjin
There is nothing wrong with swing. Personally i don't like SWT. You have to read input-values from widgets and store them in normal variables before a dialog is disposed.
摇摆没有错。我个人不喜欢 SWT。在处理对话框之前,您必须从小部件读取输入值并将它们存储在普通变量中。