OpenJDK Discussion About JavaFX

I just sent the following letter to the OpenJDK community “discuss” mailing list:

Hi OpenJDK community!

As announced at JavaOne we (Oracle) would love to contribute JavaFX into OpenJDK as a new project called “JFX”. For some who have been following along, we’ve talked about this for a long time but finally (finally!) we’re ready to act on it and open source the platform. We are not just interested in open sourcing the code, however, we also want to move into an open development model. We already have an open bug database[1]. The project uses Mercurial, so we should fit in pretty well into OpenJDK.

Our basic motivation for wanting to open source JFX is to built a community and ecosystem support and adoption around JavaFX by increasing transparency. Of course we are also interested in getting patches and early feedback from the community[2]! Our goal is to provide the next-generation Java client toolkit, and JFX would be the next step along that path, which hopefully culminates in a JSR for the Java 9 timeframe and including JFX as proper part of the JDK. I would be the initial Project lead for JFX.

A little bit about our project:
It is a significant contribution to the corpus of open source code
It includes over 6000+ public API members (methods / constructors / etc)
It includes over 11,500 unit tests
Core libraries such as observable collections and binding
Scene graph, effects, graphics
CSS support for JavaFX
Prism (hardware accelerated graphics, including openGL and D3D and java2D implementations)
Glass (windowing system, base porting layer, including mac, linux, and windows implementations)
UI Controls and Charts

Our builds are all Ant, with JUnit for testing (there is some ‘make’ in there for native parts). We also have NetBeans projects setup for each area. There is a lot of code that we’ll be releasing, so as a matter of practicality we’re going to release different parts of JavaFX over the course of the next few months, starting with UI controls followed by charts. We’ll put up a full roadmap onto our project pages, should we be approved to become part of OpenJDK. We’ll make sure that the open source code is always fully buildable by anybody using the sources + a binary plug (which will become unnecessary as we open source the remaining pieces). All of the above listed modules will be open sourced and fully buildable.

What do you think? I’d love to hear any issues and hopefully be able to resolve those prior to requesting an official vote.


[2] A good example of the sort of interesting stuff going on out there can be found here:

This is the first step towards open sourcing JavaFX into OpenJDK. First I wanted to talk with the community about it, and if it looks favorable, I’ll follow up with an official project proposal. Here’s hoping! If you are a subscriber to “discuss”, please go and throw in some good word for the idea and if you have any questions I’d like to hear those too. If you aren’t a member of “discuss”, go join :-). You can do so here.

It feels good to finally be getting this all out in the open source!

FXML + Guice

FXML + Guice

There has been a very interesting thread in the JavaFX OTN forums about FXML and dependency injection. I went and downloaded Google Guice and wrote a small sample to try it all out. Things are not perfect quite yet (I still need full Unified Expression Language support added to FXML), but so very, very, very close!

What I ultimately hope to accomplish with FXML and CSS in JavaFX enterprise applications is that we (a) fully separate the visuals from the “controller”, (b) are left with a very simple “controller” that is highly testable, and (c) everything is highly modular.

CSS allows the designer to come in after the fact and modify the look of a UI without the developer’s help, and without a full build cycle. FXML allows a developer or designer to alter the structure of the view without a full build cycle. So (a) should be well in hand, especially if the controller itself can be injected rather than declared directly in the FXML file as it is today. (I’m OK with, even prefer, saying “I would like to have a FooController for this FXML file, if you please”, but what would really rock is if the FooController were an interface or abstract class rather than always being a concrete class, such that a DI framework like Guice could find the appropriate implementation and supply it).

Don’t use impl!

I was just working my way through the last few days of posts on the JavaFX OTN forums and noticed somebody who was trying to learn how to write a custom layout pane and included the following code in the forum posting:

public class MyLayout extends Pane {
@Override protected void layoutChildren() {

@Override protected void layoutInArea(Node arg0, double arg1, double arg2,
double arg3, double arg4, double arg5,
HPos arg6, VPos arg7) {

@Override protected void impl_layoutBoundsChanged() {

This reminded me that I had failed to write a blog warning of the perils of using impl_ methods in JavaFX 2.0. DON’T EVER USE THEM!!


JavaFX 2.0 Released

Whoa! It is kind of embarrassing that we haven’t yet blogged about the fact that JavaFX 2.0 has been released! In our defense, it has been a very busy past few days. At the JavaOne Technical keynote Monday morning I announced 4 things:

  • GA Release of JavaFX 2.0 (32 bit XP, 32 & 64 bit Windows Vista and Windows 7)
  • Developer Preview release of JavaFX 2.0 for Mac OS X
  • Early Access (for partners) of JavaFX Scene Builder (RAD tool)
  • Netbeans 7.1 Beta with support for JavaFX

In addition, on Tuesday Adam Messinger (VP Java SE, Java Client, Java ME — my bosses boss) announced that we are open sourcing all of JavaFX. We are asking the OpenJDK community for a new project where we will put JavaFX. In addition, we will be working with the JCP to propose JavaFX as an official standard part of the Java platform (probably targeted for Java 9).

There was also a very exciting demo which you probably have already seen, where Nandini Ramani (VP Java Client, my boss) showed JavaFX running on both a Samsung Galaxy Tab (atop Android) and an iPad. Needless to say, this has generated quite a bit of buzz. I’ll blog separately about how this works and why (I gave a session on the subject on Tuesday).

We’ll also be blogging with our slides from the conference. In the meantime, the conference is ongoing, and I’m late for a session I wanted to attend. I’ll also post some slides from the Monday Keynote and Tuesday keynote (if I can get my hands on them)