java JavaFX 是否完全替代了 Swing?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15362783/
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
Is JavaFX complete replacement of Swing?
提问by Ashish Pancholi
I had a Java Desktop Application in which graphical user interface had designed in swing. After we came to know that JavaFX replacing Swing
We have replaced graphical user interface with JavaFX.
我有一个 Java 桌面应用程序,其中的图形用户界面是在 Swing 中设计的。在我们知道JavaFX replacing Swing
我们已经用 JavaFX 替换了图形用户界面之后。
"6. 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 is included in the JRE. On one hand, Swing is widely used in existing Java desktop applications, but relies on an old architecture, which requires a certain level of expertise and specialization. On the other hand, JavaFX features a set of modern UI controls that can be skinned using standard CSS techniques. While we recommend developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to use Swing and JavaFX within the same application, allowing developers to extend existing Swing applications."
“6. JavaFX 是否会取代 Swing 作为 Java SE 的新客户端 UI 库?是的。但是,在可预见的未来,Swing 仍将是 Java SE 规范的一部分,并包含在 JRE 中。一方面,Swing 被广泛使用在现有的 Java 桌面应用程序中,但依赖于旧的架构,这需要一定程度的专业知识和专业知识。另一方面,JavaFX 具有一组现代 UI 控件,可以使用标准 CSS 技术进行换肤。虽然我们建议开发人员在构建新应用程序时尽可能多地利用 JavaFX API,可以在同一应用程序中使用 Swing 和 JavaFX,允许开发人员扩展现有的 Swing 应用程序。”
Now we heard that Oracle donate the JavaFX toolkit to the open source community and OpenJDK Community had agreed to take it on.
现在我们听说 Oracle 向开源社区捐赠了 JavaFX 工具包,OpenJDK 社区也同意接受它。
The JavaFX toolkit evolved from the F3 project at Sun. Initial releases were based around the JavaFX scripting language, however, in 2011 the toolkit was completely rewritten in Java and released by Oracle as JavaFX 2.0. In October 2011 Oracle announced that it would donate the JavaFX toolkit to the open source community and by November 2011 the OpenJDK Community had agreed to take it on.
JavaFX 工具包从 Sun 的 F3 项目演变而来。最初的版本基于 JavaFX 脚本语言,但是,在 2011 年,该工具包完全用 Java 重写,并由 Oracle 发布为 JavaFX 2.0。2011 年 10 月,Oracle 宣布将向开源社区捐赠 JavaFX 工具包,到 2011 年 11 月,OpenJDK 社区同意接受它。
I do not think so JavaFX is stable. It has no quick support. Document are not enough explanatory. It does not release internal memory when stage is closed. My application is multithreaded application and most of time taken by my application in updating status of each individual thread. Self contained copy of JRE in native bundle does not reliable, we have to replaced it with JRE folder that resides into JDK.
我不认为 JavaFX 是稳定的。它没有快速支持。文档不够解释。当舞台关闭时,它不会释放内部存储器。我的应用程序是多线程应用程序,我的应用程序大部分时间都在更新每个线程的状态。本机包中 JRE 的自包含副本不可靠,我们必须将其替换为驻留在 JDK 中的 JRE 文件夹。
It's really frustrating and I wonder, if JavaFX is fit to develop the Java Desktop application.
这真的很令人沮丧,我想知道 JavaFX 是否适合开发 Java 桌面应用程序。
采纳答案by mKorbel
Is JavaFX complete replacement of Swing?
I think that not,
我认为不是,
most of components are halfsized in compare with Swing (price for development ???),
implementations in JavaFX8 (accesible with Java8) has one important point Swing JComponents could be accesible from JavaFX containers and JavaFX Components will be accesible in Swing JContainers (implemented in newer JavaFX2.2),
then JavaFX will be accesible for development of DeskTop applications
still question is if will be possible to add JavaFX TextArea together with Swing JTextArea in one JPanel or vice versa (Panel from xxx.scene.xxx)
more (the best infos, roadmap, development...) on FX Experience(notice occasionally is down :-)
与 Swing 相比,大多数组件的尺寸只有一半(开发价格???),
JavaFX8 中的实现(可通过 Java8 访问)有一个重点,Swing JComponents 可以从 JavaFX 容器中访问,而 JavaFX 组件可以在 Swing JContainers 中访问(在较新的 JavaFX2.2 中实现),
那么 JavaFX 将可以用于桌面应用程序的开发
仍然的问题是是否可以在一个 JPanel 中添加 JavaFX TextArea 和 Swing JTextArea,反之亦然(来自 xxx.scene.xxx 的面板)
更多(最佳信息、路线图、开发...)关于FX Experience(注意偶尔会关闭 :-)
回答by 8bitjunkie
According to Oracle, JavaFX isa replacement for Swing:
根据 Oracle 的说法,JavaFX是Swing 的替代品:
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6, question 6, says:
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6,问题 6,说:
Is JavaFX replacing Swing as the new client UI library for Java SE?
JavaFX 是否正在取代 Swing 作为 Java SE 的新客户端 UI 库?
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.
是的。但是,在可预见的未来,Swing 仍将是 Java SE 规范的一部分,因此包含在 JRE 中。虽然我们建议开发人员在构建新应用程序时尽可能多地利用 JavaFX API,但可以使用 JavaFX 扩展 Swing 应用程序,从而实现更平滑的过渡。