Jun 2, 2011

JavaFX vs Java Swing vs AWT

A long awaiting JavaFX 2.0 Beta is finally here. I couldn't help trying it one more time and implemented some very basic application.


I used SWING, AWT and javaFX to implement the same naive calculator application. The overall impression is quite good. Some issues I have to mentioned:
  • I couldn't find a way to set the alignment of a component (node) inside the grid layout.
  • ChoiceBox behaves in a very strange way. The user experience is very odd with keyboard.
  • ChoiceBox changes its size during selection.
  • I don't any means to support Action like approach.
  • JavaFX components doesn't support localization out of the box.
  • Documentation is incomplete

It is also interesting to compare appearance of different java GUI toolkits:


You can easily recognize ancient AWT, Swing trying to mimic native look and feel and absolutely modern JavaFX.

Another figure shows memory consumption of thous applications:


As you can see, JavaFX are doing quite well.

What was quite surprising for me that JavaFX application employes less threads than others. There are the numbers:

JavaFX22
Swing31
AWT33

Source code of those applications is available for everyone:

1 comment:

tbee said...

Just to let people know; you can use MigLayout in JavaFX2. That should solve any problems you have with GridLayout.

http://java.net/projects/miglayoutfx2

http://tbeernot.wordpress.com/2011/03/11/javafx-2-0-ea-and-miglayout/