Home >
If you haven't heard the news yet, today Sun released the JavaFX preview SDK (previously covered on insideria here and here). I decided to dive and and see it for myself. Here's what I found (from a developer's perspective)...
All you need to do is download the Netbeans 6.1 distribution with the preview SDK, and it installs everything you need to get started. (Well, you need java 1.6, but I already had that installed).
There are lots of samples to get started with *basic* things.
Just create a new project, then select a sample template to immediately start diving into existing code/applications.
The samples cover everything from a more-advanced weather application, to specific examples of loading images, working with animations, working with colors and math, handling keyboard/mouse input, and shape transformations. These examples were extremely helpful figuring out where to dive in and start playing things, and how things work inside the JavaFX runtime.
General Impressions
First of all, getting around the IDE is easy. Netbeans is a mature IDE, and users who are already acclimated with Eclipse/Flex Builder will find many similarities.
Next, the JavaFX scripting language. I have to admit that I found this awkward to use. It may just be my unfamiliarity with the new technology, but the structure of the language seemed a little confusing... kind of like a hybrid of JavaScript and Java. It is object oriented, but not everything is apparently clear. There are lots of brackets in there, so watch out for simple syntactic errors. When you start digging in, its also not immediately obvious where functions are called from (such as "init" or "create" for a CustomNode instance. I think a little more time with the technology will help here.
Performance-wise, I was very happy with the smoothness of the animations inside the runtime (although i didn't put it through rigorous tests). After all, it is Java, and Java has very mature graphics APIs.
One thing that I haven't figured out about JavaFX is what their perspective of a RIA really is. Most of the examples actually are run as separate applications (separate operating system windows). To me, RIA means it should be run in the browser, either as a full-page application or embedded within html, not as a separate/disconnected application outside of the browser. There are huge advantages to desktop interoperability, but the "meat" of the application should be through the web.
One thing I did not like was the download time for a simple animation when embedded as an applet. My first experiment was to port the "Sine Wave" example to run as an applet embedded in the browser. The actual project jar file for my application was a measly 35 kb (this is great), however the jar dependencies add up to over 10 megs, and there is a delay when loading the application. You can view my demo here.
Overall, I think this is a great step for RIAs in general. Sun/Java has the potential to become a major player in the RIA game. Flex/AIR is still undoubtedly my "weapon of choice", but I'll be keeping a close eye on JavaFX.
Related Links (borrowed from David Tucker):
JavaFX Site
Preview SDK Download
JavaFX Reference
JavaFX Blog
JavaFX Screencasts
Beginner Tutorial Series
___________________________________
Andrew Trice
Principal Architect
Cynergy Systems
http://www.cynergysystems.com





Facebook Application Development
Andrew,
I checked out JavaFx today as well and posted some initial thoughts over at my blog .. I had very similar thoughts as yours ... I don't particularly like the YAML like way of describing UIs either .. I find XML to be a much better way to describe interfaces.
I think the RIA perspective is Applets .. JavaFx apps will be embedded in the browser as applets once Java SE 6 Update 10 comes out .. The added spice will be the ability to drag running apps from the browser to the desktop using the new draggable applets feature ... I'm personally a little skeptical about applets being the deployment model of JavaFX since I feel a lot of people have a mental block against applets.
Oh and the download time is definitely disappointing.
Mrinal
I just tested your example in Opera and Firefox on Windows XP and I have to say that the loading times are not acceptable at all! It took 45 seconds to finally see ... a light grey rectangle. I don't know what your example application is supposed to look like but from the description I would say that a comparable Flash file would need 1 or 2 seconds to load and display.
Can you imagine that in the "real world" anyone's waiting 45 seconds for a minimal application?
Thomas
I agree, the ability to drag an application from the browser to the desktop will be an interesting new feature. From the videos on the site, it looks like you just drag it out, and it keeps working. Now, if you want to re-launch it later, do you need to go back to the web, or is it now installed as a desktop application?
From what I heard in one of the videos a developer can write code to to ask the user if he wants a shortcut on his desktop .. this could happen when the user is about to close his dragged out applet.
Mrinal
About the download times ... I think (dont know for sure) that when Java SE Update 10 releases some or all of the JavaFX libraries that are downloaded right now will probably become part of the JRE itself and since the actual application jars are quite small the download time would improve.
Mrinal
That would be extremely helpful for the download times, and the shortcuts for desktop apps would be helpful too.
Hi. This is Josh Marinacci from the JavaFX team at Sun.
Mrinal: yes, you can configure a draggable applet to request a desktop shortcut when the user closes the browser and the applet has been dragged out. Essentially applets are now Java Web Start apps (they share the cache, download infrastructure, security, etc.), except that you don't have to go through the extra install process. For more info see:
https://jdk6.dev.java.net/plugin2/#EXPERIMENTAL_FUNCTIONALITY
This is Josh from the JavaFX team. Yes, download time will be greatly improved in the future. The JavaFX runtime for desktops will be hosted at a single Sun location, meaning it will be cached once and shared between all JavaFX apps. Additionally, we plan to pre-install / bundle it with future JREs (exact details to be worked out). Remember, this is just a preview release. :)
We really appreciate your feedback. Thanks!
- Josh
Hi Josh,
Thanks for the additional information.
Great write-up, Andrew! Regarding download times and file sizes, please take a look at my Getting Decked: Another JavaFX Custom Node post. After reading the article, take a look at a reader (Pepejeria) comment and my response/analysis about download times and file sizes for that particular application.
By the way, my view of RIA differs a little from yours. In my opinion, Rich Internet Applications are those whose presentation layer runs on the user's machine, providing a responsive and visually pleasing experience, regardless of whether it is running within a browser.
If I may speak plainly, I think that Web application development is in its current state of insanity (did I say that out loud?) because we've taken a mechanism (the Web) that was created to share scientific research and tried to make it a platform that supports enterprise applications. I *really* wish that the JVM had become ubiquitous in the late 90s rather than fragmenting as a result of the browser wars. Had it become pervasive on the desktop, the client/server paradigm would have translated nicely to RIA on the Web, (and more broadly), the Internet.
For me, JavaFX and Java SE Update 10 represent (finally!) the realization of rich-client Java after an unfortunate 12 year detour.
Thanks again for the great article, and sorry about the rant,
Jim Weaver
Hi Jim,
Thanks for the additional information. No worries about the rant, they're part of the discussion.
I think the next iteration of the Java runtime (Java SE 6 Update 10), with the pack200 format will definitely make a difference in initial download and impact to the user. I also see your point about what RIA means to you. I also have seen this scenario, but have dealt with a ton of circumstances where the client/user wants a seamless rich experience inside of an existing web page/portal/experience. Unfortunately, there's no "right" answer when it comes to a RIA, so we need to be able to support everything. Way to narrow it down, right? :)
I'll be keeping an eye on this, and digging further into the JavaFX framework. I think it is very promising, and am looking forward to "putting it through the wringer".
Andrew,
Java SE 6 Update 10 supports pack200 format today. Try the Java Web Start link in the Getting Decked post. If you have Java SE update 10 installed, you'll be downloading pack200 format files.
Thanks,
Jim Weaver
Hi Jim,
Sorry, this might be a dumb question, but I'm new to JavaFX... Can you export the pack200 format from the Netbeans 6.1 IDE (from the SDK preview)? The "dist" directory appears to contain jar files. Or are they still jar files, but just use a different compression algorithm?
Andrew,
Your question is definitely *not* dumb. The JAR files that come with the JavaFX SDK release are not in pack200 format. Here's the script that I use to convert a JAR file to pack200 format, signing both along the way:
pack200 --repack ProgressNodeExample.jar
jarsigner -keystore jfx.keystore -verbose -keypass keyPassword -storepass storePassword ProgressNodeExample.jar jfx
pack200 ProgressNodeExample.jar.pack.gz ProgressNodeExample.jar
Please let me know if you have any questions,
Jim Weaver
Also, if you are using NetBeans to distribute your application as a webstart app, then NetBeans can do it for you. Right click on the project in the Projects View and choose "Project Properties". There are a few tabs near the bottom which let you enable and configure Java Web Start. One of those tabs has a checkbox to use pack200 and auto-sign the jars. Then when you build your app it will sign and pack200 your app's jar along with the JavaFX runtime jars.
Andrew,
My assessment isn't so rosy.
I didn't get good frame rates from JavaFX-SDK1.0pre1 when doing big transitions.
In addition, I have genuine concerns that the JavaFX team will not be able to get memory consumption and startup time to be competitive with Flex.
It is probably a good time to take another look at JavaFX. The team just released an update to the SDK (which was originally relesed in Dec '08), tool chain (IDE plugins & production suite), samples, etc. Notably there is support for mobile devices and many performance improvements. Next week at MWC in Barcelona you'll see the team show JavaFX on a variety of devices from LG Electronics and Sony Ericsson.
Cheers,
--Octavian Tanase
Sr. Director, Java Platform Group