JavaFX Tutorial – Basics

JavaFX seem to be gaining ground on the RIA space. With the right tools and development support, it wil definitely have its toll on the next best technology “thing!”. I’m not writing any JavaFX review here since there is a lot of Technology critiques out there that probably reviewed it extensively, but instead, I will write a simple tutorial on how can you develop JavaFX application in your MacOSX lion. 🙂

First some pre-requisites:

  • JavaFX Runtime Environment
  • Java Runtime Environment
  • JavaFX SDK
  • JavaFX Scene Builder
  • JavaFX IDE – I had chosen NetBeans 7 as it already has support for JavaFX.

This can all be downloaded on the Oracle Website. You may google it. 🙂

Requirement: Create a simple application that accepts (you guess it) person details (simple registration), a custom web browser and some analytics.

Technology: JavaFX and JPA 🙂

Step 1: Create the Database and Tables

Simple Database and Table, download the SQL file: here

Step 2: Create the User Interface and specify the controller

Using the JavaFX Scene Builder, create the user interface.

Step 3: Development

Code the App!

NetBeans has its support for JPA – so I used it to interact with the database.

Download the source:  here

Its basically a very simple application, but I think this sample will give you a brief introduction or a head start on how to actually develop an application using the platform.

Not a bad alternative if you want to create Desktop Applications, which of course, .net offers much better solution. Though the main take away here is that JavaFX redefines Java Desktop Application Development – flexible enough to support the best of both worlds (Desktop and Web) and if thats not enough, it also supports mobile phones.

Java Magazine – November / December 2011 Look inside >
November/December 2011

I’ve recently received the newsletter from Java. I’m stunned I guess.

The whole e-newsletter was made using JavaFX Technology, I never knew its full blown capabilities in action before seeing this e-newsletter. 🙂 Check it out and see for yourself. You might want to check JavaFX RIA technology as well. Perfect for creating RIA driven applications (though still arguable since GWT and Silverlight is extremely rich in API and backed by community support).

Some “stuff” in the newsletter:

Java 8 – Java 7 haven’t quiet made a decent impact yet, but that doesn’t stop the Java community from improving it. The Newsletter introduce us to some plans and JSRs that might be included on the future SDK version.

Java 8 – along with the introduction of Lambda Expression Support: The first time I heard a programming language that supports lambda is when I tried reading through the C# docs at MSDN website. As far as I can remember, lambda expressions for c# started on the 3.5 version (or 2). I think this indicates that there are still lags on the Java side yet I won’t count them out (and will never). 🙂

I can tell all the stuff that I’ve read on the e-newsletter, or you can register yourself in it:



The Lost RIA Tech – JavaFX?

I wouldn’t say JavaFX is lost or anything, its just that I think developers usually overlook on it. The RIA space is currently controlled by Adobe Flex, GWT, Sencha, JQuery, Silverlight, ADF etc.. yet I think JavaFX has a fighting chance in that space as well.

Heres the list of current Top RIAs:

The review above is from a designers perspective. Let me give you my own perspective in JavaFX alone. 🙂

Platform: I’ll give it a 4 out of 5 rating simply because its Java. 🙂 Java is everywhere, Java is easy to learn and simple to deal with.

Application: 3 out of 5, JavaFX is actually just a new way of building Applets (and mobile applications). We all know the downside of Applets – You really have to optimize your code to prevent resource hogging. A lot of tools and resources would really help you optimizing your code for applets yet it will still fall back simply because it runs in a different virtual machine – unlike Android – Dalvik is almost native to Android SDK.

Resources: 3 out of 5, JavaFX isn’t really that popular, simple because it has a lot of competitors that is frankly better and more powerful (GWT, JSF, ADF, JQuery).

Development: I’d give it a 4 out of 5, It easy to learn JavaFX is you know your way around developing Java Applications. Though it would sometimes be weird that your actually creating a CSS file for a Desktop-like application, yet if you can live with it then there would be no problem. 🙂

it has a plugin on two of the most widely used IDE in Java Community, Eclipse and NetBeans, thus rest assure that theres a wide range of audience that will help you with your IDE issues with it.

Just to note though, this is just my cent on the technology. I haven’t tried it yet, although it would really be interesting to learn the stuff. I’ll write a tutorial for it and post it here. 🙂