JavaFX API for Java?

Last week, in a poll many java developers said they did not want to use JavaFX in their applications. A reason is probably that the APIs of JavaFX is not yet stable. It is true that JavaFX language itself is still evolving. If we search on the internet and we often get obsolete examples which no longer run in the latest JavaFX version. So “pay attention to the publishing date” is a useful tip when you are looking for documents on JavaFX.

The second reason that developers stay away from JavaFX is the lack of convenient way to integrate existing Java applications with JavaFX. Undoubtedly, the strength of JavaFX is that it is based on Java. It gets compiled into bytecode, runs on a JVM and it can call methods of java classes. While compared with Flex or Silverlight, JavaFX has the advantage of n million of Java developers and a huge amount of Java applications. This is great and it gives a robust start to JavaFX. Unfortunately, there is no official way(except for reflection) for Java to fully utilize JavaFX features directly. This becomes a substantial barrier for people to adopt JavaFX.

JavaFX’s attraction to Java developers is the functionalities that are not available in Java SE, such as animation, media processing, charting. However, the price may be too high for developers to convert their existing Java code into JavaFX only to leverage the new features. There are many Java applications out there which cannot be easily changed, esp. for enterprise applications. If we have an easy way to call JavaFX functions from Java, the adoption of JavaFX in the Java developer community will be a lot faster and wider.

I think an ideal architecture of JavaFX API may look like this:

I am not sure technically how difficult it is to come up with a JavaFX API for Java, but I think it should be given some consideration for future JavaFX releases. Since JavaFX is still in its early stage of development, I hope we can see something like this sooner rather than later.

Related Articles:

How to Display JavaFX Scene in a Swing Window

Using JavaFX Features in Java

Interoperability between JavaFX & Java

How to Show a SWING Menu in JavaFX

Convert Swing to JavaFX