FxBuilder is a Groovy builder that wraps the JavaFX Script API
FxBuilder is a Groovy builder that wraps the JavaFX Script API, allowing you to embed JavaFX content into a Swing application. You can mix & match it with other SwingBuilder based builders.
Drop fxbuilder-0.2 into $GROOVY_HOME/lib along with its dependencies
All these dependencies (except the JavaFX SDK) can be downloaded from this directory too.
Groovy 1.6.0 is the required minimum version to run FxBuilder 0.2
It is recommended that you upgrade to the 1.6.x series in order to take advantage of
- @Bindable and ASTTransformations
- short binding syntax
- numerous enhancements made to SwingBuilder and FactoryBuilderSupport
Most of the JavaFX Script 1.2 code you see out there can be reimplemented in Groovy using FxBuilder, with some minor adjustments. The following JavaFX Script application
can be rewritten with FxBuilder like this
Notice the following changes:
- FxBuilder uses map notation instead of object literals
- the scene instance is automatically attached to it's parent: the stage
- the scene's content is automatically attached to it's parent, no need to define a content: property or node.
Additionally you can:
- set a Groovy closure anywhere a JavaFX Script function can be set
- set a Groovy List anywhere a JavaFX Script Sequence can be set
- content: property is automatically assumed given the build context, works on
- any Swing component will be automatically wrapped via SwingComponent.wrap()
- you can embed a JavaFX Scene in a JPanel (or any other Swing component) using the
FxBuilder uses Ant as its build tool, which means that if you want to
build your own version of FxBuilder from source you'll need to have it
installed. Follow the instructions at http://ant.apache.org
Please contact the Griffon team members by e-mail.