Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Groovy vs JavaFX

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Groovy:


JavaFX Script:


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.

Comments?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Example #2

Groovy:


JavaFX:
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic