Use Ensemble to learn ScalaFX by example
November 13, 2013Posted by on
ScalaFX-Ensemble was created in 2012 by members of JUGChennai. It was inspired by the JavaFX Ensemble. Recently, there was a major overhaul of the examples. The code was simplified and updated to work with latest release of ScalaFX. ScalaFX-Ensemble is now a part of the newly created ScalaFX organization on GitHub.
To run ScalaFX-Ensemble you will need to download the source code. You can do it either by checking out the source using Git or simply downloading zipped source using “Download ZIP” button on ScalaFX-Ensemble project page.
You will need to install SBT and set JAVA_HOME environment variable to point to the directory where your JDK is installed. For Java 7, JAVA_HOME will be used to locate JavaFX runtime, it is assumed to be in $JAVA_HOME/ jre/lib/jfxrt.jar
With SBT and JAVA_HOME set, you can change to directory to where you saved ScalaFX-Ensemble and from command prompt execute command: `sbt run`. This will download needed dependencies, build and run the ScalaFX-Ensemble application.
ScalaFX-Ensemble application lets you browse code examples using the three view on the left or the grid in the center.
Selected example is displayed in the central pane (under “Demo” tab).
You can view source code selecting “Source” tab.
Each example is a self-contained ScalaFX application. You can use the “Save SBT Project” to save the example together with SBT build configuration. To build it and run outside the ScalaFX-Ensemble use SBT command `run`. To create project configurations for IntelliJ IDEA and Eclipse, use SBT commands `gen-idea` and `eclipse`. Detailed instructions how to run examples using SBT and generate IDE setups are in README.md file saved with the project.