Thursday, July 31st, 2008
JavaFX: The preview has landed
<p>JavaFX was announced at JavaOne…. in 2007, and we are now seeing a preview release.Josh Marinacci of the JavaFX team put together a post with an example that builds the following:

The code for this is simply:
- package blogdemo;
- import javafx.scene.*;
- import javafx.scene.paint.*;
- import javafx.scene.geometry.*;
- import javafx.application.*;
- import javafx.scene.transform.*;
- import javafx.input.*;
- import javafx.animation.*;
- import java.lang.System;
- var angle = 0.0;
- Frame {
- windowStyle: WindowStyle.TRANSPARENT visible: true
- width: 400 height: 400
- stage: Stage {
- fill: null
- content: Group {
- translateX: 100 translateY: 100
- content: for(i in [0..10]) {
- // here is the magic with binding
- Rectangle {
- fill: Color.rgb(25*i,0,0, i/10.0)
- width: 100 height: 100 arcHeight: 10 arcWidth: 10
- stroke: Color.BLACK strokeWidth: 5
- transform: bind [
- Transform.rotate(-i*36+angle/2,50,50),
- Transform.translate(angle/4,0),
- ]
- }
- }
- onMousePressed: function(e:MouseEvent):Void { System.exit(0); }
- }
- }
- }
- var anim = Timeline { keyFrames: [
- KeyFrame { time: 0s values: angle => -360 tween Interpolator.EASEBOTH },
- KeyFrame { time: 2s values: angle => 360 tween Interpolator.EASEBOTH },
- ]
- autoReverse: true
- repeatCount: Timeline.INDEFINITE
- };
- anim.start();
And you can check out the application if you have Java 1.6 installed.
Michael Coté got together with the Sun folks and recorded a demo and interview:
I am interested to see what Sun does with JavaFX, but I have to admit to being underwhelmed and more excited about what Sun could do with the Java plugin and have that as a way to interact with Ajax applications.
Related Content:











Seems like someone who wants to use Java in the browser would lean more toward GWT (which doesn’t require a plugin). But I suppose it depends on exactly what you want to do and how you want to work.
@Nosredna
GWT supports only a limited subset of Java and is limited to the Browser’s scripting engine. JavaFX (or Java), with proper support and plugins, could theoretically support anything in the JRE (running in a sandbox, of course) – including accelerated graphics, sockets, and more.
I’d be interested in seeing a more stable Java plugin, and more intuitive ways to interact with the DOM or Javascript.
meh… I want to see something that interacts with and is far more integrated into the browser and the DOM. this example leaves much to be desired, and given Silverlight is leaps and bounds past this, and Adobe AIR and Flash are farther still, and part of 90+% of all browsers, JavaFX has a long way to go, and some serious catching up to do…
Unfortunately, this is more of the same from Sun lately… too little, too late. Sun should concentrate all efforts on J2EE 6 and stop worrying about this market which is already dominated by others.
underwhelmed is an understatement…
In the video, she is using a 6u10 feature (applet dragging) on OSX. Anyone know how to get that working on OSX without waiting for Apple to release their version of 6u10?
@jaydfwtx: I believe in the latest update to the JDK by Apple it goes to 1.6 but it’s only for the latest 64bit Intel Mac’s :( no 32bit Intel or PPC.
I can’t download the Java update, I’m in an embargoed country – Canada!
.
* sigh* what did we do this time?
>>GWT supports only a limited subset of Java and is limited to the Browser’s scripting engine.
Yeah, but I don’t even install Java anymore. :-)
You win that round Nosredna.
certainly is awesome, although i think canvas may give javafx a run for it’s money.
>>You win that round Nosredna.
.
The amazing thing is, the web seems dead if you try it without Flash, but works just fine without Java. I don’t feel like I’m missing much of anything except for ads. Maybe if Flash had never shown up, Java would be more important in the client.
@fighne That is true, but not what I asked. I currently have Java6 on my mac, but it is 1.6_05… 6u10 is not out for macs yet. Since the draggable applet feature comes in 6u10, and she is showing it on a mac, then they must have a special build they are using or they have hacked it to work somehow.
Apart from a performance gain, I don’t see any reason not to do this with the Flash Authoring environment and Actionscript 3.
Kudos thought for the feature that allows the app to run locally by simply dragging it outside of the browser window.
Thats not as exciting as the title suggests.
However, Intresting never the less