This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I thought I'd post both these code examples as a demonstration. This is about as simple as you can get with both Groovy's SwingBuilder and JavaFX Scripting.
The differences are obvious yet subtle somehow. Obviously differences will arise as things get more complex. Specifically when we begin to add events to the GUI but I thought this was a nice comparison to start out with.
When running the JavaFX demo, I can change the GUI and get immediate response: I can see what't the effect of changing a color, size, transparencey, tranform, etc. Groovy would be a nice language to use instead of JavaFX, but will it be possible to get that immediate feedback?
The challange maybe isn't to write better Groovy version for the JavaFX, but to make Groovy a better development environment for this kind of application.
Competition is good: we need to make the SwingBuilder handle Java2D and animations. If JavaFX can do that, Groovy should also be able to do it.
I have been thinking of using Groovy (and SwingBuilder) for GWT. And the GWT way would work also for JavaFX -- if it ever made it to the browser. We could generate it all from our Groovy source, in the GWT manner -- even if Groovy itself will never be ubiquitous in the browers. Let JavaFX be the small runtime in the mobile phone, and let Groovy be the development environment we do all the development work in.