Use Java to write GUIswingOr JavaFX?
Author: Xia Shihao
Link:/question/37236236/answer/75909071
Source: Zhihu
The copyright belongs to the author. Please contact the author to obtain authorization for reprinting.
decisiveJavaFX, because the Swing framework has not been updated for a long time. Those button controls all look like they were a few years ago (actually they are ugly, of course they have benefits, they will be faster than JavaFX, after all, they are well-written controls). Moreover, JavaFX is now built into JRE and JDK (Java8), and no longer distinguishes the version, it can also be seen thatOraclePay more attention.
In addition, JavaFX can also use Swing programs through SwingNode.
JavaFX also has a built-in WebView, which can be adjusted through it.Javascript. There are also many functions such as drawing, 3D, touch, etc.
The so-called JavaFX rendering speed is much faster because it supports graphics pipline.
So decisively JavaFX, it's likewindowsYou don’t need MFC or Winforms on it, you use WPF.
Posted on 2015-12-09 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
3
Agree and object, your name will not be displayed
Yan Rujun, Nongda University, I have a story, do you have wine?
3 people agree
Javafx is relatively new, Oracle was launched in 2008, with relatively powerful functions and continuous updates. swing is an older GUI that makes things like Window95 and 97. However, most teachers still talk about awt and swing, and most people cannot give up at once. Oracle has made it clear that it is not updating swing. (Actually, just like Saipan was abandoned back then, it was more tactful)
According to the poster's own conditions, since you have not learned both, you can just study javafx directly. Now, as long as it is a newer java textbook, the GUI part will be directly javafx.
In addition, just like swing has WindowBuilder, Oracle also developed SceneBuilder for javafx, which automatically generates FXML files. The poster can play with this, just like building blocks, which is very interesting.
Posted on 2016-03-29 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
3
Agree and object, your name will not be displayed
Zhihu User Student
3 people agree
JavaFX is the next-generation GUI framework promoted by Oracle. Although JavaFX has declined slightly in RIA technology, many concepts and technologies in desktop GUI development are stronger than Java Swing! If you want to learn Java desktop development, recommend JavaFX technology!
Posted on 2015-12-04 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
1
Agree and object, your name will not be displayed
Wang Zhongjin is the first batch of java practitioners in China.
1 person agrees
Decisive JavaFX.
JavaFX is very powerful, it is faster to use than swing, has much less code, has a beautiful interface, and has a lot of online instance code.
JavaFX has been integrated into jdk8 and is still developing rapidly. In jdk9, different small versions have changed. jdk9 has not been officially released yet. "I heard that oracle has given up javafx" can be inferred that this is not the case at all.
I am now using the early version of jdk9 to make Javafx applications.
Posted on 2016-12-12 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
1
Agree and object, your name will not be displayed
Mu Yuzhu likes programming
1 person agrees
I learned JavaFX first,lambdaThe control logic of writing controls for expressions is still very smooth. Later, when I looked at swing, I didn’t want to read it anymore because it was very uncomfortable to write. Let’s use code as an example below.
Draw a line in JavaFX
Line line = new LIne(startX, startY, endX, endY);
But drawing a line in swing is
Line2D line = new (startX, startY, endX, endY);
Java itself is long-winded, and swing is even more long-winded than JavaFX.
Furthermore, computer-study should all know css. JavaFX supports JavaFX version of css, so if you want to set the fill color for a circle, you can write it like this.
Circle c = new Circle(10, 10, 5);
(“-fx-fill: red”);
It feels very similar to CSS, which is convenient to use.
Moreover, JavaFX supports animation and multimedia. In addition, FileChooser can simply write a video player.
Posted on 2016-05-02 3 comments Thanks Share Collection • No Help • Report • Reproduction is prohibited
1
Agree and object, your name will not be displayed
vegetable
1 person agrees
JavaFx CPU occupies a higher level, Swing is lighter.
Posted on 2016-04-20 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
1
Agree and object, your name will not be displayed
Anonymous user
1 person agrees
There are a lot of JavaFX Chinese materials on it, which is not bad.
Posted on 2016-08-28 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
1
Agree and object, your name will not be displayed
Lone Wolf
1 person agrees
javafx
Posted on 2015-11-21 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
0
Agree and object, your name will not be displayed
Anonymous user
Javafx also plans to build a 3D API. Looking at the shader in the demo, you can see that the underlying layer uses two interfaces to implement Opengl and D3D. In the future, it may also support Vulkan and unify the shader syntax.
Moreover, javafx's ui can use fxml(xml)+js(can use js of java objects)+css(fx custom version css) to write the desktop like the front-end. Wouldn't declarative layout and style customization beauties?
I have also seen a javafx project. The core logic and event processing are all written in js, so I used java to write the main start method at the beginning.
Edited on 2017-01-22 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
0
Agree and object, your name will not be displayed
chubby and swollen programmer
Of course it's Javafx. The default interface of swing is extremely ugly. There is no way. The Unix series is all a habit. After Javafx is redesigned, it suddenly becomes new. At least the default interface will look much better.
Posted on 2016-12-05 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
0
Agree and object, your name will not be displayed
Chen Linjiang Computer
As a veteran, I strongly recommend that you use javaFx, which will get started quickly and the display effect is better than gui
Posted on 2016-08-28 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
0
Agree and object, your name will not be displayed
Anonymous user
Strongly promote JavaFx
Posted on 2016-03-25 Add a comment Thanks Share Favorites • No help • Report • Author reserves the right
Worry-free Programmer / Father / The hopeless dead house
I personally think JavaFX is a strategic mistake of oracle.
JavaFX died before she was born.
The people from the Swing team at that time understood UI, but they didn't use Java very well.
The overall design of Swing is very academic and exemplary, but the specific implementation code is a bit bad.
The one who answered the previous question about Line2D is actually a relatively independent part of the API, generally called Graphics2D, or Java2D. This part of the API design is exactly very excellent, although the operating efficiency is not satisfactory.
Return to the question: If you insist on writing GUIs in Java or using Swing out of interest, at least what you have learned is valuable and will be helpful for you to learn other UI frameworks.
There is a book recommended to you:.
Also, I quietly tell you that there is one advantage in learning desktop UI programming, that is, you can watch the web front-end community to put the desktopsoftwareMake the mistakes you have made again, and then reinvent the solutions and designs you have found in the desktop software, and then re-invent something again.
Posted on 2016-12-13 2 Comments Thanks Share Collection • No Help • Report • Author reserves the right
0
Agree and object, your name will not be displayed
Jin Yishan Our generation will eventually feel regretful, not because of bad people...
JavaFx has not been used
Swing is flexible and powerful, but it is difficult to learn
There is also SWT. It has simple learning, low threshold, and rich APIs, but it is not as powerful as swing.
Most of you learn Java to do web and Android, but few of you do interfaces, very few
Posted on 2015-11-06 7 Comments Thanks Share Collection • No Help • Report • Author reserves the right
0
Agree and object, your name will not be displayed
Anonymous user
I heard that oracle has given up javafx?