Friday, August 15, 2008

JavaFX and Adobe Illustrator

JavaFX is Sun's attempt at capturing the Rich Internet Application market. Currently the king of the RIA domain is Adobe with it's Flex and AIR products. Adobe is king not because their flash run-time is excellent or because Flex is such an excellent language to work with. It is king because it integrates its creative tools, such as illustrator, into the development process. This integration has made Adobe's products the go-to option for the vast majority of web content developers. Sure there are a few great applets out there, so great, people often assume they are flash applications.

Sun has recently released a preview SDK of JavaFX which includes plugins for a hand full of creative products, including Adobe's Illustrator. The following is a review and critique of how these new tools address the development process.

The required downloads are Netbeans 6.1 with JavaFX and Project Nile. Project Nile is a collection of plugins so designers can export content from their favorite design applications as long as they are either Illustrator or Photoshop.

The installation of both of these components is simple enough and a quick inspection of Illustrator shows that, yes indeed, JafaFX files can be exported.

There seems to be no real guide as to how to set up a JavaFX project for development. Creating a new project in Netbeans sounds like a good place to start, create a project of type JavaFX.

Once a project is created it is worth spending some time to checkout what Netbeans provides. There seems to be a Main class created automatically, there is also the JavaFX Library, please note in the image that the JavaFX SDK is actually running on Java 6, not 1.5, there was some configuration issues leading to this typo.

Now in Illustrator, create some content. It should be simple to have it displayed in a Java application.

Export the file and save in the same folder as the Main.fx file from the Netbeans project created earlier. Be sure to use Java class capitalization for the file name, as the name of the file you select will be the name of class that is created.

As can be seen a class with the same name is the exported file. The Font used in the content is also exported, which is very handy. The next step is to actually display this content, this is done by editing the Main.fx file to display an instance of this exported class.

Here is the code to actually display the content in a JFrame:

package fxtest;

import javafx.application.*;
import javafx.scene.*;
import javafx.scene.paint.*;

var content:Content;

Frame {
var stageRef:Stage;
visible: true
stageRef = Stage {
fill: Color.WHITE
content: [
content = new Content()

First is the output from Java and the second is a close up of what is displayed in Illustrator.

There are some obvious fidelity issues, the blacks are not exactly the same, and worse yet, the text layout is messed up in the Java version.

There are also some issue where not all content in Illustrator is exported, try using the "symbol spray" tool to add some tasteful blue birds and export it again. Rerun the Java application and notice there are no birds displayed. Also, notice that the export dialog did not remember which directory you last exported in, this is super annoying.

It is excellent to be able to produce content in Illustrator, it would simply take forever to create even the simplest content if this has to be done by witting code.

Netbeans is an excellent IDE and a pleasure to work with.

The development cycle is not well thought out. With Flex, the designers and the coders work from the same source code. This makes things like version control a snap. Flex also allows coders and designer to work with the same tool, enabled by eclipse. It is not clear how an iterative development process will deal with the current system.

The fidelity of the export, coupled with some content not being exported at all, is worrisome. It will be difficult for the designers to produce good content when they can not trust the WYSIWYG tool they are using.

A good start, this is a preview release after all. The cons listed above simply have to be addressed, especially if one accepts the premise that Adobe's RIA technologies are the leaders because of their tool support.

No comments: