JavaFX In Practice - An Interview With Stephen Chin

DZone 's Guide to

JavaFX In Practice - An Interview With Stephen Chin

· Java Zone ·
Free Resource

[img_assist|nid=7220|title=|desc=|link=none|align=right|width=160|height=160]I was interested to stumble across WidgetFX recently. It struck me as a good use of the JavaFX technology. A month after the JavaFX 1.0 release, it's good to see innovation and progression in the community. WidgetFX is a desktop widget platform written in the JavaFX Script language. It can run widgets written in either JavaFX Script or Java. I talked with the project lead, Stephen Chin about the WidgetFX project and JavaFX in general.

James Sugrue: Could you introduce yourself, and give us some details on your development history?

Stephen Chin: Sure.  I have been a long-time Java geek since the 1.0 days when synchronization was a dirty word.  My two passions are open-source software and agile development, which dovetail nicely in the Java world.  During the day I strive to create an environment for developers that I would want to work in, and in the evenings I try to contribute back just as much benefit as I derive from open-source projects.

Sugrue: What is the code base like for WidgetFX?

Chin: The WidgetFX codebase was written from the ground up in JavaFX Script, and we try to keep it pretty tight.  Whenever the codebase starts feeling cumbersome it gets a good refactoring, because I am one of those people who will drive twice as far around the mountains rather than sitting through a bad traffic backup.  As anyone who was waiting for the WidgetFX 1.0 release will tell you, quality is a much higher concern than promptness.  ;-)

Sugrue: What is the motivation for WidgetFX?

Chin: To put it simply, writing WidgetFX was a whole lot more productive and fun than it would have been to use an existing framework which requires you to hack HTML and Javascript.  The final push came from a discussion with Joshua Marinacci where we were talking about the need for a desktop widget framework written in JavaFX, and while we both agreed that it was needed, Josh clearly didn't have the time to do it himself.  A few days later (after a super-productive Memorial day holiday), WidgetFX was born.

WidgetFX also fills a very important niche for enterprise widget deployment.  For multiple reasons, including licensing terms, security model issues, and cross-platform support, most desktop widget containers do not meet the requirements to be deployed in a corporate setting.  WidgetFX is an open-source project built on the Java platform, which makes it a perfect fit for companies looking to deploy desktop widgets behind the firewall.

Sugrue: Is the ability to interact with Flash and Flex widgets easy to implement in JavaFX?

The Flash/Flex support in WidgetFX is based on the JDICplus libraries from the brilliant Alexey Utkin, so I can't take all the credit.  However, working out all the browser kinks to embed Flash, make it work in transparent windows, and supporting dragging of Flash widgets was probably one of the longest weeks I've had in a while...

The real value of embedding Flash is that you open up a huge library of existing components and provide a migration path for Java developers already on the Flex train.  I hope Sun sees the same value and provides some native, cross-platform container support for embedding Flash in a future version of JavaFX.

Sugrue: Is it possible to run WidgetFX widgets in Swing applications, and vice versa?

Embedding Swing applications in widgets is possible with a little bit of glue code.  All you need to do is create a JavaFX widget stub that uses SwingComponent.wrap() to embed the Swing UI components.Going the other way is a little more challenging.  There was a good blog post by the dynamic JavaFX trio (Josh, Rich, and Jasper) that explains how to embed JavaFX in Swing through the unsupported JXScene class, but it would be great to have this be part of the core APIs:http://blogs.sun.com/javafx/entry/how_to_use_javafx_in

Sugrue: A month after the launch of JavaFX 1.0, what are your impressions of how the community has adopted it? Is there still a long way to go for JavaFX?

Chin: I have been pleasantly surprised that the Java development community is warming up to JavaFX.  After an initial outcry of pundits spelling doom and gloom for Sun's new RIA platform, I have seen lots of positive responses about the technology from the Java community.I started another open-source project called JFXtras that fills in a lot of the holes and limitations of the JavaFX 1.0 release by providing a complete Grid layout, Dialog support, Declarative Unit Testing, an Asynchronous Worker, and a whole lot more.  I have been surprised at how much interest there has been in JFXtras, both from users and also top-notch open-source developers who are willing to lend a hand.  Among others, Andres Almiray of Groovy GraphicsBuilder fame recently joined the JFXtras project and is the mastermind behind the new custom shape support we will be releasing shortly.

Sugrue: What is your favourite thing about JavaFX?

Chin: I would have to say that I am a bind-a-holic.  It is strangely addictive to be able to hook up your model to your UI without writing event handlers or hand-writing bean synchronization code.  I also use it for doing simple layouts, keeping the UI and model in sync, and even as a pattern for inversion of control (IoC) in JavaFX Script.

I am actually in the process of writing the upcoming Pro JavaFX book together with Jim Weaver and Weiqi Gao.  It has become an outlet for sharing all the things I have learned about JavaFX in writing WidgetFX and working on my other JavaFX projects.

Sugrue: What tips would you give to adopters of JavaFX?

Chin: The JavaFX platform is still young, so use it for what it is good at today, and give it some time to mature.For those who like to live on the bleeding edge, I would recommend they check out the JFXtras project, because it may already have what they need to build a full application, or can always use additional contributors to create components that benefit the whole JavaFX community.

Sugrue: Is there a large community of widget writers for WidgetFX?

Chin: I have been impressed with the folks who have stepped up and taken an active roll so far.  Pär Dahlberg and Ludovic Hochet, the first two widget authors back from the Preview SDK days, were right on the ball in updating their widgets the first week WidgetFX 1.0 was released.  Jim Weaver has also posted a few examples on his blog with more to come.  And I am super-excited about some of the discussion on the WidgetFX mailing list about new widgets in the works.

Sugrue: What are your plans for the future versions of WidgetFX?

Chin: One of the features that is in the works is a seamless browser/desktop experience.  If you remember the famous Sun demo where they drag applets off onto the desktop, and they magically become Web Start applications, think of this as the answer to the question, "So what next?"  Well how about taking that same application and docking it on the WidgetFX sidebar...

There is also a huge queue of enhancements and improvements in the works.  The project issue tracker is a great place to see what else is coming, or to contribute enhancements and ideas.

Sugrue: Do you have any predictions for software development in 2009?

My prediction is that this will be the year that the RIA movement will help reclaim developer sanity.  Forcing all web applications to run inside the limitations of browser scripting languages was a tremendous setback to the modern computing era and sanity of developers across the world.  I have a lot of respect for the intellectual work that has gone into modern AJAX implementations and Javascript code generation libraries, but reproducing decade-old UI paradigms in the browser is not going to advance the computer science field.  JavaFX has the potential to unleash the creativity of everyday developers by providing a platform that is limitless in possibilities.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}