In a previous post i said JavaFX lack was a design tool to promote a good relationship between developers and designers, essential for membership of the community around this technology. Knowing that designers will not change tools easily the best approach would be to make a bridge between the existing design tools and JavaFX. That is the purpose of Project NILE by offering a Illustrator and Photoshop plugin to export a FXD or a FX file but also a SVG converter and a graphic viewer.
It’s the good strategy i think, so I realized a test.
To enhance collaboration designer / developer I went looking for graphic work on the net, I found « glossy » buttons proposed in .ai and .svg.
The SVG test was not good, the conversion did not include the effects and a lot of corrections were needed to compile. I continued with a conversion via Illustrator. The first shot will not compile because I am european ;). In the second time it compiles and the result is almost identical to the .ai document. Just a slight color problem quickly corrected.
The FX script is composed of a set of SVGPath, each character of the keyboard is also defined in a SVGPath. A little difficult to operate as it would be more practical to extract a component and to apply behavior as typically a mouse click and passing it in setting its position and character to display.
I extract in script the definition of a button I replace the SVGPath character by a Text component. I add a click event on the mouse and I change the effect when the mouse button is pressed.
Then I create a second class will manage the position of keys looping over an array of characters.
And then I put it all into an Applet following James Weaver advise.
Below the result, click on the keys and put the Applet out of the browser by pressing the Alt key and dragging the Applet. The launch time is long be patient (30s), I don’ t know why right now, I will ask Sun.
Note: being able to put the Applet off the browser, it require to create a JNLP and therefore to sign all jars depending on the applet. A little boring, it is necessary to automate this task:
- certificate creation: keytool-genkey [-keystore
- JAR signing: jarsigner [-keystore
] . jar
By putting all the time spent in developing it take about 4 hours, including learning of JavaFX. This is correct but it would be nice to further reduce this time. I believe that it is difficult to manipulate JavaFX without at least one real-time viewer. One provided in NetBeans 6.1 is a little slow.
Finally, the idea is there and it is promising because with the Java Plugin to 4MB will finally have rich full Java apps that take advantage of being able to do more than the competition: access to serial devices, Bluetooth, … on the client, using existing Java APIs (eg JMS), switch to desktop app…