what is the difference between java desktop application and javafx?

okapobh picture okapobh · Aug 9, 2010 · Viewed 22.2k times · Source

What is the difference between a "normal" Java desktop application (with AWT or Swing), and a Java application built with JavaFX?

What are the advantages and disadvantages of each?

Answer

Praeus picture Praeus · Aug 17, 2010

I think what you are asking is what are the pros and cons of building a JavaFX desktop application vs a Java Swing desktop application. After experimenting with both I can point out a few differences:

Java Swing

Pros:

  • Better visual designer and IDE support
  • More full featured set of controls
  • Good for building business applications such as user interfaces on top of a database where you don't need capabilities beyond the standard (and third party) controls.

Cons

  • Poor multimedia support
  • Building custom controls or custom skins is very difficult
  • No animation support
  • Java syntax can be awkward for building UIs. The IDE makes this less of an issue, but if you ever have to do anything manually it can get ugly.

JavaFX

Pros

  • Decent multimedia support
  • Easy to build custom controls, and all existing controls are skinnable using CSS (I haven't tried CSS yet though).
  • Animation support is good - not quite as good as flash but its good enough for basic animations.
  • The syntax seems better suited for building UIs, especially for hand coding them - which is good because you will need to hand code them.
  • Good for building multimedia applications or applications where you need a custom look.

Cons

  • The visual designer needs work, and personally I don't use it. This can be a big negative depending on your needs.
  • Still lacking in some controls, but this is getting better. The controls that do exist seem to work well.
  • Swing integration exists, but they are working on changing the engine so that it no longer relies on Swing. It is uncertain how well using Swing controls from JavaFX will work on the future. So I wouldn't avoid the use of Swing controls in JavaFX when possible.