Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Open source Java projects: JFXtras

Utilities and add-ons for the JavaFX Script programming language

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

JavaFX is a rapidly maturing technology, but its capabilities are still limited. In this installment of Open source Java projects, Jeff Friesen introduces you to JFXtras, utilities and add-ons that fill in useful features that are absent in JavaFX 1.0.

JavaFX 1.0 is missing a lot of functionality, especially in regard to UI components and layouts. To address these deficiencies, developer Stephen Chin initiated the JFXtras project in late 2008. He released JFXtras 0.1 shortly after JavaFX 1.0 debuted. This initial JFXtras release introduced dialog boxes, more layouts, a unit-testing framework, and asynchronous thread support to JavaFX.

The JFXtras 0.2 milestone, released in January 2009, adds a new library of custom shapes via integration with Andres Almiray's jSilhouette Project, and it enhances 0.1's Grid layout, unit-testing framework, and more. With 0.3's release on February 17 (shortly after this article's completion), JFXtras is becoming an increasingly significant part of the JavaFX landscape.

This article focuses on JFXtras 0.2. After introducing you to the project's software distribution, I demonstrate how to use the software via the NetBeans and command-line versions of JavaFX. I then explore JFXtras' various features, ranging from asynchronous thread support and a custom shapes library to unit testing and utilities classes.

Open source licenses

Each of the Java projects covered in this series is subject to an open source license, which you should understand before integrating the project with your own projects. JFXtras is subject to the updated Berkeley Software Distribution (BSD) License. It is not subject to the simplified variant of this license or to any other license.

Getting started with JFXtras

The JFXtras project site's downloads page provides links for downloading JFXtras-0.2.jar and JFXtras 0.2.zip. If you're interested in the custom shapes library, you must download the ZIP file, which includes JFXtras-0.2.jar and two other JAR files that provide the jSilhouette scene graph infrastructure for custom shapes. If custom shapes are of no interest to you, you can download JFXtras-0.2.jar instead, but I recommend downloading JFXtras 0.2.zip. This archive's JFXtras 0.2 home directory contains the ChangeLog.txt, JFXtras-0.2.jar, and LICENSE.txt files. It also contains javadoc (API documentation), lib (jsilhouette-geom-0.3.jar and jsilhouette-scene-0.3.jar, custom shapes support JARs), src (JFXtras source code), and test (scripts for unit-testing JFXtras) subdirectories.

In addition to JFXtras 0.2, you need to install either NetBeans IDE 6.5 with JavaFX 1.0 or the JavaFX 1.0 SDK (if not already installed). Also, Windows platforms should have Java SE 6u10 or a higher update installed, whereas Macintosh platforms will benefit from Java 10.5 Update 2 (1.6.0_07). I developed this article's code with both JavaFX SDKs and Java SE 6u12 on a Windows XP SP3 platform.

A simple script

Before exploring JFXtras, let's play with a couple of examples, to familiarize you with developing scripts in the context of the NetBeans and command-line versions of JavaFX 1.0. For our first example, check out Listing 1.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (5)
Login
Forgot your account info?

I figured it out why I couldn't compile Main.fx.By Anonymous on March 17, 2009, 8:57 amI changed to use JFxtras-0.3.jar, now it works fine.

Reply | Read entire comment

I can't compile Main.fxBy Anonymous on March 16, 2009, 9:34 amfirst, thank for your document. I followed your step. But I got exceptions after I compiled Main.fx: the error message is below: java.lang.NoClassDefFoundError:...

Reply | Read entire comment

very well writtenBy Anonymous on March 8, 2009, 8:37 pmAn excellent job of explaining complex material. Thanks for sharing your work.

Reply | Read entire comment

Create more project.... By Anonymous on March 5, 2009, 6:12 amJava FX-The most pervasive and powerful mobile platform is now the most expressive. I learn more regarding this matter. Create more project....

Reply | Read entire comment

interesting sourcesBy Anonymous on March 2, 2009, 5:46 pmI found interesting sources about the installation of open source java projects featured by Jeff F.,last Feb.26.Keep up the good works.

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • Download the sample code for this article.
  • Visit the JFXtras project site for downloads and documentation.
  • JFXtras 0.2's custom shapes are based on the jSilhouette collection.
  • JFXtras creator Stephen Chin was one of the developers interviewed for "Client-side Java's evolutionary leap" (Jeff Friesen, JavaWorld, January 2009) a roundtable on the current state and rapid evolution of JavaFX and other client-side technologies.
  • Jump into JavaFX is a six-part series introducing JavaFX, from early experiments with the Preview SDK through JavaFX 1.0:
  • Unwrapping JavaFX 1.0 is a JavaWorld podcast with Sun's Param Singh and John Burkey on the eve of the release of JavaFX 1.0. Also read about the release of JavaFX Mobile in February 2009.
  • Read about the BSD License
  • "JavaFX Async operations" (James Clark, Clarkeman's Weblog, December 2008) discusses subclassing JavaFX's AbstractAsyncOperation class.
  • Read Wikipedia's entries on Reuleaux triangle and Lauburu, two of the shapes supported in JFXtras.
  • Stephen Chin demonstrates the JFXtras native menu classes in DockDialog.fx, part of WidgetFX.
  • Learn more about fold higher-order function in Wikipedia.

More from JavaWorld