Skip to main content

Top 5 Most Important Features in JavaFX 1.2

Posted by joshy on June 9, 2009 at 10:12 AM PDT

Technically I'm on vacation this week so don't mention this post to my boss. I simply couldn't wait to blog about cool stuff we put into JavaFX 1.2. Shhhhh!

Lots of JavaFX related things were announced at JavaOne, many of them concerning future products and other bits that aren't released yet. This post won't cover any of those. There were so many things discussed at JavaOne that I'm afraid some of the key points of the new JavaFX might have been missed. In this post I'm only going to cover the things that you can actually download and work with today. I'm talking only about the new version of JavaFX, previously codenamed Marina, and now called JavaFX 1.2. Without further ado, here is my personal list of the most important features.

Top 5 Most Important Features in JavaFX 1.2

Linux and Solaris support

Support for JavaFX under Linux and Solaris has been a long time coming. It's always been in our continuous build system and we really wanted to ship it with the 1.0 release, but too many things were broken. Finally, after much hard work, we have a beta release. Our goal is to make Solaris and Linux equal platforms with Windows and Mac in the JavaFX world. JavaFX is about having one Java across all of the screens (Desktop/Mobile/TV) as well as all of the OSes (Mac/Win/Linux/Solaris). This is one more step towards that goal.

Some features still don't work, which is why we are calling it a beta release, but it's a good starting point. We are now using GStreamer for the video support, which was one of the key features previously missing. You will get some graphics hardware acceleration depending on your distro and configuration. Shaped windows do not work yet. This is due to a bug in the underlying JRE. The graphics guys say they have a fix which will be rolled out into Java 6 and OpenJDK soon, so you won't have to wait until the next release of JavaFX for cool rounded windows.

[screenshot]

Controls and Layout

JavaFX has had great graphics but at the 1.0 release had only a single native UI control, TextBox. It's kinda hard to make a real business oriented application using only text controls. That's all changed now. JavaFX 1.2 has real UI controls, designed for the 21st century. We looked at everything we always loved and hated about Swing, and considered long term UI toolkit trends. Then we build a new control and layout API that addresses the kinds of applications people need to build today. Here's just a taste of what's in the new controls:

  • All controls are skinnable with CSS, so a designer can create a common look across all of your applications.
  • There is a new modern default look and feel, Caspian, designed to look at home across OSes and on mobile devices
  • Controls are in the common profile, meaning they will work on all devices, not just desktops.
  • New controls for standard features like progress indicators and the hyper link
  • All built on top of the JavaFX scene graph, so there are no remnants of AWT.

Along with the controls is a new layout system that addresses the biggest problems with the AWT layouts. It is now super easy to mix layout with animation, and to create custom layouts using only a few lines of code. With controls we can build real business applications that run across multiple screens.

There are a few controls missing from the current list. In particular you will notice the absence of Table and Tree. It's not that we don't have plans for them. There simply wasn't enough time and we didn't want to hold back the release. Rest assured they are coming.

PreviewScreenSnapz001.png

PreviewScreenSnapz002.png

Charts

Along with controls the most important feature for building business applications is charts. Charts are such a common request that we built them into JavaFX. All of the standard chart types are there, including pie, scatter, and bar charts. They are very easy to use and customize. You can also create your own chart types using a few lines of code. Here's a few examples.



Data: Persistence, RSS/Atom, and Tasks

Previously you could work with data only by dropping down to Java code. This would be fine except for the fact that mobile Java code is different than desktop Java code. In addition, every form of Java has it's own special API for persisting data. To fix this problem we've added new support to JavaFX common profile to hide these kinds of platform differences and let you get back to coding great apps. Here's a quick list of the new stuff:

  • javafx.io.Storage for persisting data locally on any client platform
  • javafx.data.feed.* built in support for RSS and Atom data feeds
  • DateTime, Math, and Properties as JavaFX classes
  • javafx.async.* base classes for all asynchronous operations in JavaFX, including a clean way to implement Java based tasks

Speeeeeeed

Our goal is for every updated to JavaFX to be faster, and I think we definitely hit that goal. Across the board you will find JavaFX 1.2 to be faster than 1.1 and 1.0. In terms of startup time, memory usage, and graphics performance we have improved every part of the JavaFX user experience. For certain tasks you will see as much as a 3x improvement over the previous release.

To achieve this speed improvement we revisited almost every part of the platform. The compiler switched from using true multiple inheritance to mixins. This eliminates most of the nasty corner cases that gave multiple inheritance a bad name while providing what developers want 90% of the time. As a side benefit the underlying compiled bytecode is smaller and faster.

The graphics team did a lot of work redesigning the scenegraph to handle updates to the scene more intelligently. The result is fewer repaints and a more responsive user interface.

There were also bug fixes across the board to the video & audio stack and the underlying graphics pipeline. In addition, we put a lot of work into JavaSE 6 update 14 to reduce startup time and improve webstart performance. Over all you will find JavaFX 1.2 to be faster and smoother than the previous releases.

SafariScreenSnapz021.png

Just the beginning

The five features I listed above are just a small part of the many improvements in JavaFX 1.2. What's most important is this is part of a larger plan to have regular smaller releases of the JavaFX platform rather than the huge 2+ year release cycles of the JRE. Faster and smaller releases ensure that we ship high quality software to you faster, and lets us better incorporate your feedback. If there is any feature you feel is missing please send us a note or file a bug at javafx-jira.kenai.com.

Back to vacation for the week and then time to dive into the next release. Please let us know how you like JavaFX 1.2 and what you are are building with it.

Comments

Hi Joshy, I am playing around with JavaFX Mobile and I have a question about the optional JSR's. Is it possible to add new API's and use them on my HTC Diamond? I tried to use JSR.82 and JSR-256, but none of them works, my phone does not start the programms. I saw your Accelerometer example and tried to use it, but it only works in the emulator. Is there anything I need to consider running this example on my phone? thanks huetz

If you need great publicity + community of zealots + amazing brains ... make JavaFX FOSS-friendly (support InkSpace, Xiph.org as cross-platform codecs, etcetera)... If you want a market big bang explosion, release ready-made video/sound player that can run video, and capture audio/webcam. Ala-Flash but with more features. If you want marketing through word-of-mouth, release a wower application that will be the talk-of-the-year. An application that's useful (not a boring demo). And of course, above is useless without releasing a FREE JavaFX designer tool that's as easy as (or easier than) Adobe Flash Studio. When you do this (plus the above mentioned), it'll be a sure win. But what's there for SUN if JavaFX became the next craze of the decade? Where's the return of investment for SUN comes in? Answer: the money lies in storage and hosting, and consulting. Amazon and Google will be your biggest competitors for hosting services so better plan ahead. One more thing. The better JavaFX, the more developers will be compelled to learn it, the more developers, the more applications will be written in Java (embedded, desktop, server), the more applications, the more can Sun/Oracle beat Microsoft! So you better speed up JavaFX.

Great looks awesome, but I nned grid and tree too for my daily work ! I like javafx but is really slow compared to swing ! response times are really really slow. But looks great good job and thanks for sharing with us !!! enjoy your holidays Josh !

Please include a Grid/Table control ASAP! I'm forced to write my new biz app using WPF/Silverlight because there's nothing like those controls in JavaFX which was my first choice. Although we could implement something similar using lists I really don't have the time to start thinking in creating new controls. Let's be honest: the JFX technology is cool, but you cannot create serious business apps just with buttons, slide bars and textboxes. The charts are great but not enough. Finally, is there a tutorial on how to integrate JFX with real-world databases? Something related to Oracle or SQL Server would be great. Anyway, great job. Enjoy your vacation and we wait for you so you and your team can address the above issues.

Impressed with the progress of JavaFX and the demos in JavaOne were impressive. However when are we getting a way to integrate a JavaFX scene inside a swing app? (I know about the reflection method - but something official and supported would be nice)

Josh. Can I use this scenegraph and chart API in Java? I

Josh, I would like to see Tree, Table, TreeTable. In a financial application (my field), we like to usually support flashing, complex renderers/editors, MVC pattern, etc. Excellent work.

Josh, while the new controls look lovely, I do see one major issue in using them for re-writing existing Swing applications in JavaFX (even if the Tree, Table and combobox are eventually supported in JavaFX). And that is - integration with third party Swing components. Wont doing a mix and match (of JavaFX controls and 3rd party Swing components) make the app look inconsistent? If so, doesn't this imply that the JavaFX way of doing controls requires 3rd party providers to re-write their Swing components in JavaFX and jump on the bandwagon, so that UI consistency is eventually reached? Or we should just stick to good old Swing, and use the new runtimes only for performance? Sorry if I sound sour, but really, how do we bridge the Swing-FX gap going forward?

@jseltzer: shameless plug: watch http://fxexperience.com for some information on the theming. I know that Jasper has a blog in the wings that I think will be ready sometime later this week on the UI design that went into the controls and will blog more about how to theme.

I'm still confused about video codec support. Is on2 supported in the current linux/solaris versions (even though they're beta)? Does it support all video types that GStreamer supports natively, and on Windows does it support any video/audio type the underlying OS supports? If I wanted to use video in a truly cross-platform way, is on2 the only choice? If the plan for JavaFX is to go open source and the open source version will not have the on2 codecs, would it be useful in the next pre-2.0 version to provide an alternative for all platforms in readiness? OGG Theora/Vorbis is a good candidate, it's open source and will be supported by the next Firefox for HTML5 elements. Don't drop on2, but the open-source audio/video alternative will ease transition when JavaFX goes open source and on2 is dropped.

It looks like the controls use a new UI theme. Is there a web page or post that describes the fonts/colors etc that make up the theme?

I need to update my rant. :) I pulled down the safari 4 final today (had been running the beta and safari3) and java plugin (jdk1.6_13) works FAR better there. I have to assume that they were doing all of their internal testing on this build. The disk priming now seems to work, the painting issues are gone, the load times are between 3-5s. So, much, much better on the mac. The load times still need to improve, but that is coming and understandable(should always be under 3s). From the looks jdk7 might improve that dramatically. Only problem is we may not see that for years on osx. There are still some minor errors (splash screens not working, no transparent windows, flickering on browser scroll, etc). However, I am sure the jfx team is working on that. In response to 'fabriziogiudici'. Javafx will be open source before it is all said and done (though I am sure they won't be able to release the on2 codecs). So, I don't see that as an impediment. Early in a project, open source or not, it is far faster to develop in a controlled environment. I would bet that we would see jfx released as oss with the 2.0 release. All the same, supporting some oss projects(like gimp and inkscape) with plugins would make those products more viable and demonstrate good intentions.

Unfortunately, none of the samples will run in the browser in linux AMD64 ( the Java "wheel" just keeps spinning). The jnlp samples will not launch, either, giving the error: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.javaws.Launcher.executeApplication(Launcher.java:1302) at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1248) at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066) at com.sun.javaws.Launcher.run(Launcher.java:116) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NoClassDefFoundError: com/sun/javafx/runtime/Main at com.sun.javafx.runtime.main.Main.main(Main.java:35) ... 9 more Caused by: java.lang.ClassNotFoundException: com.sun.javafx.runtime.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at com.sun.jnlp.JNLPClassLoader.findClass(JNLPClassLoader.java:257) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 10 more However... the netbeans plugin seems to work alright with the .fx samples, but again, the html files won't run in the browser. In previous versions of javafx, at least some of the javafx webstart samples would run, but no javafx 1.2 samples will run in the browser. This problem is mentioned in the comments at "http://weblogs.java.net/blog/malenkov/archive/2009/06/ui_ontrols_in_j.html" and a bug report may have been filed (Jira: RT-4895), but I can't find that particular issue yet. There is also a thread on the JavaFX General forums at "http://forums.sun.com/thread.jspa?threadID=5390550&tstart=15" JavaFX is making progress on linux, but unfortunately it's difficult to maintain any enthusiasm when javafx apps can't be successfully deployed.

There's a small problem with JavaFX and the Linux community, that is: JavaFX is not open source.

My $0.02 I am very excited about the progress that is being made. From the outside, though, it feels sooooo slow (like Christmas). :) Apple: I think apple is a huge strategic platform for javafx. This is where the creative types are and the experience there is still very sub par. I think Sun really needs to work on apple and their jdk impl. I have the latest (based on 1.6.0 _ 13) and java fx still crashes safari (3&4), hangs it, or gives odd screen rendering issues when used as an applet. Even outside of the browser, things like transparent windows don't work (java app store has a big rectangle outside of it). The plugin/jdk/javafx is also slow loading on a mac. The mac experience (out of the box) has to be addressed for there to be any real uptake. While I am on platforms, I heard Gimp/Inkscape plugin support talked about in the java posse interview. I think it would be a big win if javafx were seen to be doing something in linux that noone else has ever done. That is, if the linux community sees javafx as the first fully enabled RIA technology on linux with a real commitment, then they might take it up as the UI tool of choice (as opposed to mono). While it is not a huge market share, it would go a long way from an alpha geek marketing perspective. So, publish those plugin specs and commit a couple of resources to making it happen. Components: Does it look to anyone else like the look and feel of the old ifc components that netscape did just before swing? It looks good, but my memory seems to feel like the similarity is pretty close. Could be that most of the brain cells from back then are dead. :) Clearly, javafx has to finish. They really need to hit the french fry rule on the next release. The french fry rule is based on the idea that you never want to see the person overload your carton of french fries and then take some out. You want to see them appear to be cramming in as many as possible. In other words, under promise and over deliver. Unfortunately, all of the current javafx releases feel like they are taking fries out of the box. Hey we are rolling out a component set...YEAH....only there are no tables, trees, or combo boxes. So, you will have to wait to do your UIs. Oh, and the UI designers in our tools don't suppor this yet. Or, we are rolling out the new javafx thing that has great video and audio support......except on a bunch of these(linux, solaris, mac to some extent) platforms. Or, we are targeting creative types, but we are not sure when the tools will be ready and it doesn't really work on their platform yet. Get my point? Tell us December with the new tools/complete ui toolkit/apple vm, etc and deliver it as a surprise in october. The press will be far better. We have the vision. Hopefully oracle will throw more money at it and it can accelerate next year. Anyway, sorry for the ramble and I love what it already there.

There are two big features that I know enterprise developers will be interested in for corporate intranet RIAs: 1) Elaborate Grid/table widgets 2) Calendar widgets I worked at a Fortune 500 company that had to code these things from scratch, and the code to implement them was fragile. What's more, they spent a lot of time evaluating proprietary solutions to these problems. I'm wondering if this sort of functionality is in the pipeline for JavaFX.

Hi! I'm happy to see chart components in JavaFX, but is there a built-in support for date axis? Mouse panning and zooming would be also a good thing, but, for some reason, binding a variable to the axis range minimum and maximum did not work for me. I hope this is just the beginning, and the charting will improve further.

@joshy: And what is with desktop-apps without internet-connection? And Larry Ellison have had the idea to port OpenOffice.org to JavaFX. And what is, if dl.javafx.com is down? If I would have the right to spread the runtime, I could publish it on my own side WITH JavaFX apps. But so, I must confiding, that dl.javafx.com is everytime reachable. I think, that the license is at the moment the main problem of JavaFX.

sunburned: please file a bug report on the linux + 64bit issue. prunge: I believe that it uses Gstreamer underneath so it should support anything Gstreamer does, in addition to the On2 codec. theuserbl: JavaFX apps are distributed as applets or webstart, so the correct runtime will be auto-downloaded from dl.javafx.com and cached. The runtime is versioned, so you never have to worry about a new update breaking your old app. If you wrote an app against the 1.1 runtime it will always run against the 1.1 runtime, even if we've released JavaFX 30 by then. mac users: today apple shipped final versions of the Java updates for Tiger and Leopard. Please try them out.

Grid component for JavaFX v1.2 Screenshot: http://jfxstudio.wordpress.com/2009/03/03/the-graphic-database-front-end/ How to use: http://jfxstudio.wordpress.com/2009/05/25/the-graphic-database-front-end...

Hi, I don't quite get "javafx-jira.kenai.com". How do you send a note requesting features that you think are missing? How do you file bugs? And where do you tell what your doing with JavaFX? Also I have a big critical question regarding debuging my JavaFX application. I have made this question on a lot of places (netbeans foruns, javafx foruns, etc) but everyone seems not to know the answer. What is the best place to make this kind of question? Thanks

Nice arcticle. But I am missing a Webstart-program of the first screenshot (that with the nice GUI). :-) But to a nother subject: Do you know more about the JavaFX-license? It seems, that it is not allowed to spread the JavaFX-runtime. If you download the SDK, you have only _one_ license for _one_ computer. It is not allowed to integrate it in its own programs and publish it, for example. So, creating JavaFX-standalone programs is senceless. And if you create internet programs with webstart, then you must integrate the link to Suns JavaFX runtime, that the user downloads it direct from Suns side. But JavaFX changed in 1.2 its binary-format. That means, if you have a online-program, and there comes a new JavaFX version out, your program will no longer run. Have also a look at http://en.wikipedia.org/wiki/JavaFX#License I have also already written in the forum at http://forums.java.net/jive/thread.jspa?threadID=62353&tstart=0 there are good answeres. But not related to the license. It is possible, that the runtime of JavaFX is part of the compiler-project: http://kenai.com/projects/openjfx-compiler/sources/marina-master/show it seems, that all files are there (I am not sure). But the problem is, that - unlike OpenJDK - there all the files are under the GPL _without_ GNU Classpath exception !! Do you know more about the license? If it will in any time be usable.