What will be cleaner and easier to maintain?
All things being equal, probably JavaFX - the API is much more consistent across components. However, this depends much more on how the code is written rather than what library is used to write it.
And what will be faster to build from scratch?
Highly dependent on what you're building. Swing has more components around for it (3rd party as well as built in) and not all of them have made their way to the newer JavaFX platform yet, so there may be a certain amount of re-inventing the wheel if you need something a bit custom. On the other hand, if you want to do transitions / animations / video stuff then this is orders of magnitude easier in FX.
One other thing to bear in mind is (perhaps) look and feel. If you absolutely must have the default system look and feel, then JavaFX (at present) can't provide this. Not a big must have for me (I prefer the default FX look anyway) but I'm aware some policies mandate a restriction to system styles.
Personally, I see JavaFX as the "up and coming" UI library that's not quite there yet (but more than usable), and Swing as the borderline-legacy UI library that's fully featured and supported for the moment, but probably won't be so much in the years to come (and therefore chances are FX will overtake it at some point.)
Answer from Michael Berry on Stack OverflowWhat will be cleaner and easier to maintain?
All things being equal, probably JavaFX - the API is much more consistent across components. However, this depends much more on how the code is written rather than what library is used to write it.
And what will be faster to build from scratch?
Highly dependent on what you're building. Swing has more components around for it (3rd party as well as built in) and not all of them have made their way to the newer JavaFX platform yet, so there may be a certain amount of re-inventing the wheel if you need something a bit custom. On the other hand, if you want to do transitions / animations / video stuff then this is orders of magnitude easier in FX.
One other thing to bear in mind is (perhaps) look and feel. If you absolutely must have the default system look and feel, then JavaFX (at present) can't provide this. Not a big must have for me (I prefer the default FX look anyway) but I'm aware some policies mandate a restriction to system styles.
Personally, I see JavaFX as the "up and coming" UI library that's not quite there yet (but more than usable), and Swing as the borderline-legacy UI library that's fully featured and supported for the moment, but probably won't be so much in the years to come (and therefore chances are FX will overtake it at some point.)
As stated by Oracle, JavaFX is the next step in their Java based rich client strategy. Accordingly, this is what I recommend for your situation:
What would be easier and cleaner to maintain
- JavaFX has introduced several improvements over Swing, such as, possibility to markup UIs with FXML, and theming with CSS. It has great potential to write a modular, clean & maintainable code.
What would be faster to build from scratch
- This is highly dependent on your skills and the tools you use.
- For swing, various IDEs offer tools for rapid development. The best I personally found is the GUI builder in NetBeans.
- JavaFX has support from various IDEs as well, though not as mature as the support Swing has at the moment. However, its support for markup in FXML & CSS make GUI development on JavaFX intuitive.
MVC Pattern Support
- JavaFX is very friendly with MVC pattern, and you can cleanly separate your work as: presentation (FXML, CSS), models(Java, domain objects) and logic(Java).
- IMHO, the MVC support in Swing isn't very appealing. The flow you'll see across various components lacks consistency.
For more info, please take a look these FAQ post by Oracle regarding JavaFX here.
- JavaFX Frequently Asked Questions
I read that JavaFX was meant to replace Swing, but instead got dropped from JDKs, while Swing is still kept. In another place, I read that Swing has more components than JavaFX. Also, some people seem to "like" Swing more than JavaFX.
So if I want to learn Java GUI (for desktop applications, not web), should I learn JavaFX or Swing?
Java user interface with SWING vs JavaFX - Stack Overflow
What is the difference between unsing JAVA FX and SWING - Stack Overflow
Swing or JavaFX for building desktop applications?
Begginer: JavaFX or Swing?
What Is the importance of Swing vs JavaFX vs AWT?
What is Javafx scene builder?
Videos
For great GUI, I think you should use javafx. in java 8, javafx looks more stable now. You can use javafx control to you current swing application. About database interaction, if you have bulk data in any table then please do not try to fetch whole data to javafx tableview control as It will leads to "Insufficient memory" problem. always process your data in database and dont give load to JVM. so for bulk data, I suggest you can use current JTable but javafx is pretty cool you can start exploring it. start it from http://docs.oracle.com/javase/8/javase-clienttechnologies.htm
There is no specific issues to show database data in a JavaFX TableView.
One area that may be of concern is printing. I believe Jasper had built in stuff to print JTables and JTables also have a print method. Printing a multi-page TableView is more involved.
Also if you are not able to use Java 8 you won't get the latest improvement of the api (for example related to printing).
Hi there, I have been learning Java for about 2 months so far and for the most part, it's been an enjoyable experience. I feel like I got most of the main concepts down and have created a few projects using core Java.
My 3 main goals for learning Java are to understand and think like a programmer (considering it's my first language), hammer down OOP concepts, and to finally create desktop applications.
I have done some research on GUI frameworks in Java and found two options, JavaFX and Swing. From what I have seen and heard, JavaFX is a lot more modern than Swing but is fairly new and isn't quite mature. On the other hand, Swing is a mature framework and has a lot of things incorporated in it, but it's quite old and isn't being updated as much anymore. Swing is also apart of the JDK while JavaFX is separate.
Again, correct me if my information is wrong but which one would be a good option and if it really matters which one to choose.