JavaFX is a software platform for creating and delivering rich internet applications (RIAs). Swing and Adobe Flex are similar technologies. Though JavaFX is primarily suitable for desktop applications, it is also suitable for enterprise applications. We will first see where JavaFX fits and its future by comparing it with similar technologies, and then we will see its version and history in brief, an overview of some JavaFX tools and later we will see some sample JavaFX programs.
JavaFX is intended to replace Swing as the standard GUI library for Java SE, but Swing will be included in JDK for backward compatibility. Swing is mature enough, but Oracle confirms that JavaFX is the replacement for Swing and also that JavaFX is the future path in the link http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html. Hence JavaFX is our current UI technology direction for RIAs. You can read all our technology directions @ http://www.javajee.com/our-technology-directions.
Adobe Flex is another similar technology platform. I had worked with Adobe flex using Flex builder and had integrated it well with Spring and Hibernate in one of my project. However, comparing JavaFX vs Adobe Flex today, I strongly believe JavaFX is the way now because of the fact that JavaFX is from the owners of Java and is also free. Adobe is also moving most of the Flex into a community-driven open source project (Ref: http://www.adobe.com/devnet/flex/whitepapers/roadmap.html) mainly due to other competing technologies such as JavaFX and HTML5. Hence even though I have worked more on Adobe Flex, JavaFX is our current UI technology direction for RIAs.
Though this is not actually a valid comparison, I have seen many questions related to JavaFX vs JSF. Java Server Faces (JSF) is Java’s server side technology which is an evolution of Java Server Pages (JSPs) and adds more lifecycle. JSF is a server side technology part of Java EE specification and is implemented by compliant application servers and JavaFX is part of JDK. JSF does most of the work at the server side and interacts with the browser using standard HTML controls and interactions. JavaFX requires JVM to run on the client side and hence are heavier to browsers. JSF is useful for most server side websites provided over internet as it doesn’t require much client side setup. JavaFX is required for rich internet applications (RIAs). JavaFX can be compared to Adobe Flex which requires Flash Player to be installed at the client side.
As of this writing current version of JavaFX is JavaFX 8 as it is part of JDK 8. Previous version (which is almost same) was 2.2. From Java 8 Oracle decided to have same numbering for JavaFX as that of Java. JavaFX 8 is same as JavaFX 2.2 in architecture and adds more features on top of JavaFX 2.2. Before version 2.0 of JavaFX, in JavaFX 1.x, developers used a statically typed, declarative language called JavaFX Script to build JavaFX applications. Because JavaFX Script was compiled to Java bytecode, programmers could also use Java code instead. JavaFX applications could run on any desktop or any browser that could run Java SE. However, JavaFX 2.0 and later is now implemented as a native Java library and therefore applications using JavaFX are written in native Java code. JavaFX Script has been scrapped by Oracle, but development is being continued in the Visage project. Oracle plans to integrate JavaFX to Java SE embedded 8, and more integrations and features are on the way.
JavaFX provides tools that help to develop as well as design functional and visually pleasing applications. As of JDK 7 update 6, JavaFX is included with the standard JDK and JRE bundles. Hence you don’t have to download it separately if you have a JDK version higher than JDK 7 update 6.
An integrated development environment (IDE) is a software application that provides many facilities to computer programmers for software development such as code editor, debugger, GUI builder etc. Netbeans IDE, from Oracle itself, is a very useful IDE when working with Java’s UI technologies like Swing, JavaFX or JSF and provides many GUI building features out of the box. However we will focus less on Netbeans and focus more on Eclipse IDE. Eclipse is also very popular, is plugin based with enough plugins for most use case. Also, in my software industry experience I have been using eclipse for almost all projects till date. You can find our eclipse notes @ eclipse-ide-notes. The best thing about JavaFX is that Oracle also provides another very useful tool called ‘JavaFX Scene Builder’ which is independent and not tied to an IDE, but can be used with any IDE including eclipse. You can go to the download page for screen builder from the Java SE download page, download and install it easily through few clicks. You can then configure eclipse to use JavaFX and JavaFX scene builder by installing the eclipse plugin by following tutorial @ http://docs.oracle.com/javafx/scenebuilder/1/use_java_ides/sb-with-eclipse.htm.