Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need JavaFX though we have Swing?

Tags:

java

swing

javafx

Swing is good in many ways, then why do we need JavaFX?

like image 855
Riyaz Mohammed Ibrahim Avatar asked Dec 17 '22 09:12

Riyaz Mohammed Ibrahim


1 Answers

There is both a technology part of JavaFX that will help design UIs, and a language part that will make writing UIs easier.

The JavaFX technology brings a 2d scenegraph and video capabilities. Afaik these will also be made available generally to java. They are good advancements for creating client side application with fancy and interactive graphical UIs. The 2d scenegraph should make it possible to create more graphic heavy applications that are still responsive.

The JavaFX language is a much better way off creating UIs programatically. Java Swing code can get very verbose, while the same JavaFX code will be smaller and easier to maintain. Closure support makes creating event handlers easier. Declerative assignment of settings makes configuration of elements easier. Native list syntax makes adding components easier.

Please note that I haven't really written any JavaFX, but I have read code and paid attention to what's going on. I recommend trying it yourself to find out what's cooking.

like image 177
Staale Avatar answered Dec 28 '22 08:12

Staale