What is JavaFX? 1


javafxWell, dear reader this is one of those many times where I don’t know what your background is, how much time you have spent working with the Java language or how much detail you already know about the origins of Java. So, I will go back to the start and give a quick gloss-over-rundown of the past, but forgive me if you’ve heard this part before.

Early History

In the beginning, there was “awt” or Java’s abstract window toolkit which was used for both Applets (embedded Java programs on webpages) and Applications. With this you could create buttons, checkboxes, text fields, etc and make a program with a basic user interface.

Then came Swing, Java’s updated gui (graphical user interface) library with more tools and an updated look and feel. Swing is still very popular and widely used, but now that Java has Oracle at the helm we are once again seeing Java move into a new and exciting direction.

Enter JavaFx

I was surprised to learn that JavaFx has been around for a long time. Even before Oracle acquired Java from Sun Microsystems in 2009, Sun acquired the technology when they bought out ‘See Beyond’ in 2005. It started out as more of a side project when it was first released as ‘JavaFx’ in 2007, and didn’t gain much traction even after Oracle acquired Java. But then in 2010 Oracle announced the future direction for Java which included a completely redone JaxaFx as the centrepiece technology for building applications. At the time of writing this post, the latest version of Java is Java 8 which was released in March 2014 and it is the first MAJOR Java release that includes JavaFx as an integral part of its core distribution.

JavaFx is here to stay

If you go directly to the JavaFx faq source at Oracle they state clearly that yes, “JavaFX (is) replacing Swing as the new client UI library for Java” which is why it makes sense as Java developers that we start taking JavaFx seriously and start embracing it as the best way to build applications in Java.

Summary of JavaFx Features

So what’s the big deal with JavaFx anyway? Well here in a nutshell are the main features of JavaFx, which also try to answer the question “why use it in the first place?”
What is JavaFx

  • New and improved interface tools that way WAY beyond your standard buttons, checkboxes, etc.  (Think bar and pie charts and cool things you can find using JQuery like date-pickers, accordion panes, tabbed panes etc.) . Check out a nice summary of JavaFx controls here.  This includes new media player and web rendering controls.
  • A new ‘language’ called FXML, which like HTML is used only to define the interface of an application, keeping it completely separate from the code logic.
  • An outstanding application called ‘Scene Builder’ which can be integrated into NetBeans and Eclipse to allow you to create and generate FXML documents using a drag-and-drop design interface (think Dreamweaver for HTML)
  • A new powerful way to control the design of your application with CSS-like syntax and precision.  If you know any CSS you will easily be able to make the transition to styling JavaFx applications.
  • An integrated library for graphics (both 2D and 3D) as well as animation tools that rival Flash, JQuery and CSS animations
  • Mobile platform development tools (which admittedly, I know very little about at the time of writing this post but like everything else on this site, as I learn I share).  There is an open-source project called JavaFx ports that helps bridge the path to mobile application development with JavaFx
  • Speaking of open-source, that is EXACTLY what JavaFx is.  This is cool for 2 reasons:
    1. It’s survival chances are greatly improved with a worldwide army of JavaFx fans contributing to the development and well-being of the technology
    2. Others are quickly developing additional tools, plugins and UI controls that go beyond the offerings at Oracle.  Check this out from ControlsFX – very cool!.



JavaFx is Not an HTML Killer, But it IS a Swing Killer

In an interesting blog post over at ‘Code Makery’ , the author Marco Jakob does a great comparison between the 2 technologies and comes out with the conclusion that you can’t really compare the 2 fairly as they are both used for different things (desktop application vs browser-based). But part of what makes HTML great is what JavaFx has learned from and borrowed from to make it a great improvement to the Java language. If you want a separation of code and design, you have FXML to design the interface and a Java program called a controller to handle to logic. If you want style you now have a markup language that is amazingly similar to CSS that can be used to customized the look and feel of your application. If you want to render 2d or 3d graphics or animate things, JavaFx has a canvas very similar to the HTML canvas and a whole subset of classes designed to handle animation. All in 1 download, all in 1 technology. This is actually the one place where I think JavaFx shines since to do any of this in HTML you are really trying to master many different layers of technology in one place (HTML, CSS, JavaScript, maybe even JQuery) and each is controlled by different groups.  And when you compare ANY of this to Swing, well now you can see why Swing is on the way out.

In Conclusion

Like any new technologies there are going to be those people who quickly adopt it, and those that say it is a fad and wait on the sidelines for it to pass.  I have found a couple of interesting articles as food for thought, both of which go beyond the scope of intimate knowledge I have for the issue:

I have to admit it has taken me a while to embrace JavaFx because I used to be a part of the latter group.  Maybe getting a domain and devoting an entire site to it is going a bit overboard, but I think you can see clearly which group I belong to now.  What about you?  Have you started using JavaFx or are considering trying it out in the future?  Or are you of the opinion that JavaFx too shall pass?  I’d love to hear your thoughts.  Cheers!


Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

One thought on “What is JavaFX?