Devoxx 2013 – My Thoughts on JavaFX

I’ve been in Belgium enjoying Devoxx, one of the biggest Java conferences in Europe.

JavaFX is of particular interest to us at PDF help.org, as we’ve been busily working away on implementing a variant of our viewer using JavaFX. With JavaFX 8′s release on the horizon and after watching some of the talks at Devoxx, I thought I’d give some of my thoughts on the library.

IMAG0086

Stephen Chin demonstrating JavaFX 8, Lambdas and the Stream API in Mary had a little lambda

JavaFX + Lambdas = Good looking code

I don’t think I’ve met anyone who has enjoyed implementing event listeners in java. Due to anonymous inner classes, the code can look bloated.

For example, this is the code needed to make a button print out a line to the console.

button.addActionListener(new ActionListener(){
    @Override
    public void actionPerformed(ActionEvent e) {
	System.out.println("All that for this line!");			
    }
});

And similarly in JavaFX:

button.setOnAction(new EventHandler() {
    @Override
    public void handle(ActionEvent event) {
        System.out.println("Hello World!");
    }
});

Of course parts of the code can be stripped down slightly to reduce the lines. But in production code, this is how I would structure the events.

Then in comes lambdas:

button.setOnAction((event) -> {
    System.out.println("Hello World!");
});

With half the lines and only one indentation, I can write the same method. It looks good and most importantly looks much more readable.

Incidentally, NetBeans 7.4 has the convenient ability to automatically convert anonymous inner classes to lambda expressions.

lambda_conversion

Touch Capabilities

One of the things that impressed me during the talk was Jim Weaver’s demonstration of JavaFX on a touch device (Windows 8 tablet), in the examples shown, the applications were very responsive when it came to handling rapid changes (gesturing and recognising the amount of fingers on the screen). The demonstration of  It would be nice to see JavaFX come to mobile apps, but I’m not holding my breath.

Raspberry Pi

The little computer gets a lot of love over at oracle it seems and deservedly so. In the presentations I attended they demonstrated a few Raspberry Pi devices running JavaFX. While the Dukepad decided it didn’t want to play during the demonstration (although it had a great looking lock screen ;) ), I was impressed with how Simon Ritter utilised the pi with JavaFX to create an informatics system (or as he puts it, the carputer) to monitor information about his car (such as acceleration, power output and G-forces) via the European On Board Diagnostics Interface. I’m looking forward to his extended talk on the carputer on wednesday.

 The Only Way is Up

It seems that all signs point to JavaFX 8 being very popular library. It’s true test will be in the next few years to see if it can replace it’s predecessor Swing. But judging from the crowded theatre in Devoxx and that there’s already a JavaFX 8 application, demonstrated at Devoxx by Michael Hoffer, on the apple app store.

Personally I prefer JavaFX to Swing. It feels much cleaner, sensible and most of all fun to work with.

There’s a lot I’ve not mentioned about javaFX 8, such as it’s 3D capabilities, binding of UI controls, enhancements made to FX specific collections and improved printing. (though my colleague has an article on that subject here).

What do you find interesting, about Devoxx was there anything that stood out for you? Keep checking back for my coverage of Devoxx.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the Blog RSS.

The following two tabs change content below.
Simon Lissack is a developer at IDR Solutions, working on JavaFX, Android and the Cloud Conversion service.

Related Posts:

Simon

About Simon Lissack

Simon Lissack is a developer at IDR Solutions, working on JavaFX, Android and the Cloud Conversion service.

Leave a Reply

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>