JavaFX 1.0: This Could Be Something Special

DZone 's Guide to

JavaFX 1.0: This Could Be Something Special

· Java Zone ·
Free Resource

Today will mark the 1.0 release of JavaFX, and a rebirth for the Java platform. Up to now I've had some reservations about JavaFX, but after having the chance to talk to  Param Singh, Senior Director of JavaFX at Sun and John Birkey, JavaFX Architect - I really believe this will be something great.

Before I go into the details of what's included in this release, I'd like to explain why I think this release is so good. There has been a lot said about the fact that Sun can't compete with Adobe or Microsoft in the RIA space. I disagree - now developers have a choice to use JavaFX APIs or Java APIs. Together they're a much more powerful combination than other platforms. 

Nothing To Worry About 

I talked with John Birkey about my concernts about JavaFX. After all, I've been developing desktop applications for quite some time, a lot with Swing. I was worried that the JavaFX focus would be a bad thing for Java UI Developers.

"As a longtime member of the Java community, what I'm excited about with JavaFX is that we have Swing and JavaFX. Together it gives us guys who love Java the ability to explore big apps. It's 2008 and the web is different now and so we need to make neat things that are dynamic and high value media. Swing is the best 2D UI Framework. What's exciting about the two technologies is that we have this great SE platform and then we have JavaFX with all these high value media services. It's about beauty, it's about motion. The important thing is that JavaFX script is pitched at 'let's get something visual up quickly and make it easy and fun to tweak'. You can use the declarative syntax to get things going quickly."

It's easy to hook your JavaFX UI components to data. JavaFX Script allows UI developers to avoid long IDE cycles with lots of labourious UI code to write, and to stay in the present.It's a new play about motion and beauty and going back to the web in a neat way.

The team is unified, and the names you know working on Swing are working on JavaFX as well. Octavian Tanase heads up both the JavaFX development and the Java development.

The thing about Swing that's good is for building big apps. JavaFX takes a different angle – focussing on making it easier to write up your UI. Swing developers know how long it takes to tweak their UI's and will probably never tell their managers how much time it takes! JavaFX improves productivity and is a interesting new way to do things.

Setting Itself Apart From Other Platforms

One of the key points is the power of Java. If someone has a Java application they can add a JavaFX front to it and create a nice, rich interface. If you want to create a web-resident and desktop-resident application, you get the unified Java platform runtime to do it. Doing this with the competitior platforms is hard. I know there are desktop versions like AIR, but Java has spent 10 years on the desktop building the security model, the APIs. JavaFX is new on top of Java. The other platforms trying to build these complex models – Java is already there.

When you go to mobile the same story applied. Developers building ME applications need rich interfaces where there isn't Swing. So they struggle even more. Currently when you have RIA applications on a mobile platform, they sit away from the stack. Getting these applications to tap into the Bluetooth capabilities of the phone, or the core libraries and APIs, you find that it's difficult to combine form and function. With JavaFX you see that integration come together with the JSRs supported in the phone.


I hope JavaFX reignites the Java community, getting developers to do more. My hope is that everyone says “It's Java – and it's Java Doing Great Stuff”. I hope this brings the original client side vision that Java already has to fruition. Java is dominent in the desktop and infrastructure.

What Is In Java FX 1.0

There are seven major aspects that make up this JavaFX 1.0 release. This release works with Mac, Windows but there's 100% committment on a Linux version to follow.

The Runtime 

First up is the JavaFX Runtime for Desktop and browsers which consists of all the libraries that allow developers to use text, graphics, animation, the scenegraph, audio and video. The runtime will be packaged on top of JRE 6 Update 10. As the JRE is pushed out through auto-update, JavaFX will be distributed as part of that mechanism. The runtime leverages some specific features in the JRE to allow JavaFX to run in the browser. There's an updated version of the Applet architecture and an updated version of the browser plugin in the JRE already that allows JavaFX applications to be browser-resident.

A Javascript bridge is also being delivered  as part of the package that allows interaction between the browser DOM and the JavaFX object model. So you can do simple things like click on a thumbnail on the browser and play a video, or trigger an application - it really is bi-directional.


Beta Release of Mobile Runtime 

It gets better - a beta release of the JavaFX Runtime for Mobile is being provided. JavaFX has been architected to a common set of APIs - these are the basic APIs that allow an application to be portable between desktop and mobile. An abstraction layer is included in the runtime, allowing the applications to run on mobile and desktop. So the emulator allows developers to start testing their applications ahead of the full JavaFX Mobile release in 2009 that will provide the deep integration into JavaME.

JavaFX TV will be out in 2009, but there's no emulator yet – but the common set of APIs will set the foundation for bringing it across to other devices.

The Scripting Language

JavaFX Script, which we're all pretty familiar with now, is the language available as part of the platform.


Developer Tools

To help developers along you'd expect a Sun product to release a NetBeans plugin, but they are also delivering a plugin for Eclipse. Developers using Flex or Lazlo now have a choice of building applications in JavaFX, that have tight integration into Java.

“Developers now will be able to create Rich Internet Applications with the APIs that are in JavaFX, or the APIs they know and love in the JRE already such as Swing or any library. We now give developers the choice of mixing and matching the two sets of APIs to deliver a compelling experience.”


JavaFX Production Suite

Graphic designer who literally lives their life in Photoshop and Illustrator and it can be difficult for them to work seamlessly with their developer counterparts. JavaFX solves this problem by delivering plugins for Photoshop and Illustrator that allow designers, once they've created their assets, to export it using a menu item. Those assets are wrapped, including all the meta-data like the layers, into a JavaFX format.

The goal of the format is that each of the layers has a wrapper around it, so that when it is brought into an IDE environment the developer can work with the wrapper and animate that particular layer as a background, or animate a graphical asset on a path. It's actually two way. So if the graphical designer changes the colour of that asset, or makes other changes, because it is wrapped and once it has the same name, the developer and designer can exchange the asset without needing to re-import or re-encode. It's called the Designer – Developer Workflow .More functionality through the IDE and other design tools can be expected over time.


Video Codecs 

At JavaONE 2008 Sun announced an agreement with On2 Technologies, one of the codec providers in the Flash platform, to deliver video support in the JavaFX Platform. On2 have a range of products called Flix – they have updated that product line to provide support for encoding video in the JavaFX file format. They have a 30 day free trial of the Flix standard so that you can play around with it and start coding content in their format.

Set of API Documents, Samples, Tutorials

These will all be updated in the JavaFX.com website, which currently only has the preview release. Over 50 samples will be available on the website. A range of tutorials will also be available.

"We are serious about making Java the platform of choice, across RIA, across desktop, across mobile. And really bringing forth the power of Java, getting more people to use it through JavaFX."

Now the ball is in the developer's court. I'm looking forward to seeing JavaFX being utilized to create some really impressive applications. And no, I don't think that Sun are too late entering the RIA space - with 10 years experience on the desktop they have  real chance to make an impact.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}