JavaFX 1.0 Release Set for December 4
Tuesday, December 02, 2008 |With the release of JavaFX 1.0 scheduled for this Thursday, December 4, the JavaFX team set up a technical pre-launch call and invited JUG leaders, Java Champions, NetBeans Dream Team members and others to call in and get a sneak peak at what was coming (audio and slides available here). Josh Marinacci was the engineer on hand to give us the preview. A couple of things stood out to me that has me pretty excited.
The first thing, of course, is the language itself. I’m not a language geek, so I can’t really get into the nitty gritty of what makes a language good or bad, but I do like the declarative approach to GUI building. I haven’t used Swing as much as I’d like, but I have done a lot of AWT in a "former life" and that was painful. Swing fixes quite a bit there, but it still seems like a whole lot of code. JavaFX goes a step further, making GUI code more concise and readable. It does, though, unless I’m misreading things, emphasize a node-centric approach to GUI building, which I’ll confess I don’t completely understand. It sounds like it’s a lot different from what I’m used to, so there’s going to be a curve I’ll have to overcome, but I’m excited by that. New challenges are always fun. Usually. :)
Remember those fancy videos at JavaOne 2008 with 200 videos playing at once at a three dimensional, rotating surface? That video — and MP3! — support will finally ship. Sun licensed the On2 codec for use in the JavaFX run-time, finally giving Java developers a video codec we can depend on. Having MP3 playback will also be nice, as it’s the dominant format. As nice as Ogg Vorbis might be, the world runs on MP3, so native support is huge improvement.
One of the things that has me most excited, though, is the improved Java applet support. Granted, some of this comes as part of Java 6 Update 10, but, combined, I think we might finally see client Java getting some respect. Look at this example code Josh shared. This will launch a JavaFX-based applet from any browser, if I understood him correctly:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script src='http://dl.javafx.com/dtfx.js'/>
<script>
javafx(
{
archive: "MyApp.jar",
width: 500, height: 300,
code: "myapp.Main",
draggable: true,
name: "appl"
} , {
doStuff: "true"`
}
);
</script>
If I heard him right, that bit of Javascript from dl.javafx.com handles all the dirty work for browser-specific options, version checking, etc. If you don’t want (or can’t support) your clients' browsers hitting the internet every time the applet loads, Josh indicated that the file could be downloaded and cached locally (and who’s going to know if you do, right? ; ) With Update 10, Java Web Start and Applet launching became much more interoperable, so you can now launch your applet using JNLP code. All it takes is one additional line in your .jnlp file (again, assuming I understood him correctly. Are you catch the theme here? : )
Another nifty feature is the updating of the venerable old javadoc with javafxdoc. I read a bit about this a few weeks ago, and I believe it allows running code in your documentation. If, then, you have a bit of code for which you want to include sample output, you just markup your docs correctly, and the doc processor will run that code and insert a "screen shot" produced by the code. Fancy! So is the new look (sorry for the low quality. I did a screen grab from the slides PDF. :):
He also covered, of course, the draggable applet feature of Update 10, which is really, really cool. Perhaps as exciting is the new Javascript/Java integration the update offers. Suppose you have this code running in an applet on the page:
1
2
3
public function doSearch():String {
return "I searched, honest!";
}
If you want to call doSearch
from your Javascript code, you would do this:
1
2
3
4
5
6
<script>
function doSearch() {
var appl = document.getElementById("appl");
appl.script.doSearch();
}
</script>
Slick.
He finished up covering the supported platforms, the roadmap, changes from the preview release, etc. It was nice to see JavaFX Mobile, which should be final in February of next year, getting some attention too. For obvious reasons, it seems the language has gotten all the attention, and I’ve not heard anyone in the JavaFX camp mention mobile until today, though it’s possible that I just wasn’t listening closely enough. At any rate, JavaFX looks like it will be a great development platform. Time will tell if it can take the lead against Flex, Sliverlight, etc., but I, for one, am pretty excited about it.
If you’re interested, there’s more information in the slides and MP3. Go give it a listen.