Java has a rich history in the scientific community. Applications and frameworks such as the NIH's ImageJ, CERN's Colt framework and Apache Commons Math library immediately spring to mind when working in scientific computing. My first exposure to Java in science came as a graduate student at Oxford. We needed to analyze many large noisy datasets, typically stacked (multi-page) TIFF image files. ImageJ and its excellent plugin framework was the environment of choice for this work. Other groups such as the Mosaic group at the ETH in Switzerland did similar work and have extended it beyond what we did a few years ago.
So where does JavaFX 2 come in? Well, in my recent work we've had a need to develop image analysis software yet again. It turns out this is a common theme in biology, physics and engineering labs nowadays. I decided to have a look into what was available on the JVM which was when I learned of the new Java FX 2 pure Java library. It instantly appealed as it was well documented, had plenty of examples and was free! Scientists are a diverse group too, so the ability to write once and run on Macs, Windows and Linux boxes is a massive bonus. In academic science these days you often find diverse backgrounds and amalgamations of people with broadly different skill-sets. A nice user interface, easy installation and pleasant work environment on the computer desktop is therefore imperative.
A few features stood out immediately as I began browsing examples and reading the API. These included in my order of priority: extensive graphing tools, ObservableList, easy integration with native file systems (open / save dialogs), a simple syntax, great API documentation, FXML and good Netbeans tooling. Later on Scene Builder came onto the scene (pardon the terrible pun). Having done some work with XCode for Cocoa on the Mac I thought it would be hard to stand up to it. I was wrong. Scene Builder was mature out of the box. Laying out 'AnchorPanes' or anything else for that matter is very straightforward. CSS integration also enables easy skinning for apps. This is generally much more difficult in other frameworks.
Living on the JVM and being pure Java, integration with other JVM languages is easy too. My recent forays into Scala have proven very fruitful with JavaFX. I've been building some fairly involved numerical analysis code, and it's very easy to code in Scala. I've been able to use JavaFX in pure Scala classes, extending the 'Initializable' interface and load FXML classes easily.
I've had to develop a few things building directly on the JavaFX framework, such as for example tools to load multi-page TIFF files and write various bit-depth TIFF data to JavaFX 'Image' objects. But generally plotting tools and data handling are a breeze with JavaFX 2.
IntelliJ IDEA, Netbeans and Simple Build Tool for Scala all enable mixed projects and help with building greatly. I stumbled across an sbt-javafx plugin a few days ago, which has enabled me to package my projects for distribution among my colleagues.
In short, if you have a need to develop applets for scientific work, need to load and save data with a GUI, plot graphs and get actual science done, JavaFX 2 has to be given some serious consideration! I can't imagine trying to do what I've been able to in any other framework. I hope more scientists decide to develop things with JavaFX 2, so that we can extend the body of open source code and make development even easier.
Please have a look at a couple of movies I made showing my GUIs in action. These projects are a work in progress, but demonstrate the power of JavaFX and its application to scientific computing front ends.
Dr. James Thompson (and Jim Weaver)
James did his PhD at Oxford in the Physical and Theoretical Chemistry Laboratory, researching membrane protein biophysics. After finishing, James went to Harvard Medical School for a year to work on an imaging project before moving to his present role as a post-doc at USC in Los Angeles this year. His work revolves around biophysics but uses techniques from molecular biology, chemistry, microscopy and computer science. James maintains interests in single molecule biophysics, membranes, imaging, protein structure and function and computation with Java, Scala and GPUs. His twitter handle is: drJamesThompson