The Rich Media Wars has a new contestant in the arena. Joining Adobe’s Apollo/Flex and Microsoft’s Silverlight is Sun Microsystem’s newly-unveiled JavaFX.
JavaFX (code-named F3) is targeted for rich desktop/browser applications, and especially the mobile market. They are also open-sourcing the language from the beginning as openjfx, which is quite encouraging.
Demos of JFX are available along with several tutorials, including a tool called JavaFX Script JavaFXPad Demo. This app runs via JavaWebStart and lets you create and modify a JFX GUI while seeing the results in real time. This alone is a fantastic way to promote the language.

As you can see in the screenshot, JFX uses declarative constructs as an alternative to procedural ones. The irony of JFX is that it looks a lot like JavaScript, but compiles to “real Java”. So you go from something like this in standard Java with Swing:
var win = new Frame();
win.title = "Hello World F3";
win.width = 200;
var label = new Label();
label.text = "Hello World";
win.content = label;
win.visible = true;
To this in JavaFX:
Frame {
title: "Hello World F3"
width: 200
content: Label {
text: "Hello World"
}
visible: true
}
If you’re more comfortable with the procedural approach, you can still use it, since JavaFX supports both. Sun is also providing scripting-support plugins for both NetBeans IDE and Eclipse.
There is a lot more to uncover with this language, so expect more content on TechBrew.net about JavaFX in the weeks and months to come.

Email

2 responses so far ↓
1 Andy Brudtkuhl // May 9, 2007 at 1:23 pm
It does look remarkably like Javascript.
One thing I did not look into is the requirements for the client to use this. Does it run on anythning like the JRE? Or does it have a separate download?
2 Mark Woodman // May 9, 2007 at 2:07 pm
It can run within a standard 1.5 JRE (like the demos do via JavaWebStart). I’m still investigating the small-footprint runtime options, so I can’t answer that part yet.
Leave a Comment