unsing JAVA FX 和 SWING 有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35264887/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 23:55:43  来源:igfitidea点击:

What is the difference between unsing JAVA FX and SWING

javaswingjavafxcompare

提问by user1914272

I am using Java Swing to develop my application and i should finish it as soon as possible, but the design is very bad. I found some advice which tells me that I should use JAVA FX. What is the difference between Java FX and Java Swing ? Will there be any change on the line of code?

我正在使用 Java Swing 开发我的应用程序,我应该尽快完成它,但设计非常糟糕。我找到了一些建议,告诉我应该使用 JAVA FX。Java FX 和 Java Swing 有什么区别?代码行会有什么变化吗?

回答by Prim

Main difference could be the release date... JavaFX is more recent and can be considered as the successor of Swing.

主要区别可能是发布日期...... JavaFX 是最近的,可以被视为 Swing 的继任者。

There is many very useful features added in JavaFX. See here some key features : https://docs.oracle.com/javase/8/javafx/get-started-tutorial/jfx-overview.htm#A1131418

JavaFX 中添加了许多非常有用的功能。在这里查看一些主要功能:https: //docs.oracle.com/javase/8/javafx/get-started-tutorial/jfx-overview.htm#A1131418

I can list the main features for me:

我可以为我列出主要功能:

  • Styles can be set by CSS (something similar to)
  • Bindings: easy way to bind a ui-value, like width of text of input, to a field in class. Changing the value of the field updates the ui without boilerplate
  • Animations/Transitions: easy way to make an animation, like a ui components which blinks or moves
  • 3D: easy way to manipulate model to make animated 3D view
  • 样式可以通过 CSS 设置(类似于)
  • 绑定:将 ui 值(如输入文本的宽度)绑定到类中的字段的简单方法。更改字段的值会更新 ui,而无需样板
  • 动画/过渡:制作动画的简单方法,例如闪烁或移动的 ui 组件
  • 3D:操作模型以制作动画 3D 视图的简单方法

For making a new application from scratch, i think you should consider using JavaFX, Swing is outdated (imho)

为了从头开始制作新应用程序,我认为您应该考虑使用 JavaFX,Swing 已过时(恕我直言)