Friday, November 10th, 2006

F3: Sun’s new declarative Java scripting language

Category: Java, Library

Chris Oliver, now at Sun via SeeBeyond, has posted about a new declarative Java scripting framework that Sun will be open sourcing shortly.

My project is called F3 which stands for “Form follows function”, and its purpose was to explore making GUI programming easier in general.

F3 is actually a declarative Java scripting language with static typing for good IDE support and compile-time error reporting (unlike JavaScript…), type-inference, declarative syntax, and automatic data-binding with full support for 2d graphics and standard Swing components as well as declarative animation. You can also import java classes, create new Java objects, call their methods, and implement Java interfaces.

We have IDE plugins for both Netbeans and Eclipse Both plugins support as-you-type validation, code-completion, syntax highlighting, and hyperlink navigation (with control-mouse-over).

F3 attempts to demonstrate that we’re not exploiting the full capabilities of the Java platform for GUI development and that together with supporting tools like F3, the Java platform is highly competitive with or superior to competing GUI development platforms such as Macromedia Flash/Flex/Open Laszlo, Adobe Apollo, Microsoft WPF/XAML, Mozilla XUL, AJAX/DHMTL.


  1. import f3.ui.*;
  2. import f3.ui.canvas.*;
  3. import f3.ui.filter.*;
  5. Canvas {
  6.     content: Text {
  7.         x: 20
  8.         y: 20
  9.         content: "Welcome to F3"
  10.         font: Font { face: VERDANA, style: [ITALIC, BOLD], size: 80 }
  11.         fill: LinearGradient {
  12.             x1: 0, y1: 0, x2: 0, y2: 1
  13.             stops:
  14.             [Stop {
  15.                 offset: 0
  16.                 color: blue
  17.             },
  18.             Stop {
  19.                 offset: 0.5
  20.                 color: dodgerblue
  21.             },
  22.             Stop {
  23.                 offset: 1
  24.                 color: blue
  25.             }]
  26.         }
  27.         filter: [Glow {amount: 0.1}, Noise {monochrome: true, distribution: 0}]
  28.     }
  29. }

would produce:

And then a demo of a flash port that took a couple of days:

I think that we all feel that GUI work could be easier than Swing currently is. I wonder if a new language that is a hybrid of Java and JavaScript makes sense, or if they could use the latest ECMAScript?

Posted by Dion Almaer at 11:17 am

4 rating from 25 votes


Comments feed TrackBack URI

Seems to be rather similar in idea and syntax to the Enlightenment project’s Edje. Edje has been around for something like 5 years now.

Comment by Hallvar Helleseth — November 10, 2006

You should also check out Groovy, particlularly their implementations around both SWT and Swing


Comment by Al — November 10, 2006

Note that the original URL for this is here:

Wasn’t sure why there isn’t a link back to the original site….

Comment by Johnny Thawte — November 10, 2006

Flash killer. Datestamp it.

Comment by Karl Moz — November 10, 2006

Flash killer? no way! Did you see that flash port thing?? Its a flash port! Means a flash port..means a flash dependent..not a flash killer..its a flash subset. It may be superior to javascript , in the sense that there is not JS IDE[poor Netscape, those loosers are cloning Digg and shit, missing the serious game.Lamers!]

oh and look at that screenshot..its amazingly lame! Poor rendering! I think they are competing with a future Microsoft release,of some Flash killer.

Comment by jane — November 10, 2006

[…] Chris Oliver, now at Sun via SeeBeyond, has posted about a new declarative Java scripting framework that Sun will be open sourcing more | digg story Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages. […]

Pingback by F3: Sun’s new declarative Java scripting language at There was Code; Then there was AJAX! — November 11, 2006

yawwwn !

Comment by foo — November 11, 2006

Hmm.. If you want to declarative programming and automatic databinding, in pure Javascript, in pure Open Source, keep your eyes peeled for the next couple of weeks for the Javeline Platform SDK. I’ve been following the beta for a while and it is quite nice…

Comment by Wiebe Joustra — November 13, 2006

Great work by Chris. Will try this out pretty soon.

Comment by HC — November 20, 2006

If you get tire of working with braces, give jython a try. For a simple example:

Comment by Steve Weaver — December 19, 2006

Leave a comment

You must be logged in to post a comment.