Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.
See all our reports

Best JavaFX libraries for beautiful apps and clean code

In this post, I’ll list the libraries which we learned about in the latest Virtual JUG session: The JavaFX Ecosystem by Andres Almiray. Andres has presented on the Virtual JUG before; you might remember his excellent session on how to use Gradle effectively. Here are a few of words about our speaker.

Andres is a Java and Groovy developer and a Java Champion with more than 17 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated in popular projects like Groovy, Griffon, DbUnit and so on. He’s also a founding member of the Griffon framework and Hackergarten community event. You can find more info about him at http://andresalmiray.com/ or find him on Twitter and ask any questions about JavaFX, Java on desktop, Gradle, Groovy, or anything. He’d love to respond: @aalmiray.

JavaFX libraries you should not miss

The session focused on the open source JavaFX libraries that offer something that you often need in a project. And it was organized by topic: layout, testing, icons, and so on. So we’ll follow that path and cover the JavaFX libraries that Andres gave a shout out to. Disclaimer, this is not the full list of the libraries in the JavaFX ecosystem! But it’s a great place to start if you’re new to JavaFX, or if you have some experience with it and want to get better.

Layout

MigLayout

MigLayout is a layout engine is written in pure Java, which values simplicity, power and automatic per platform fidelity. User interfaces created with MigLayout are easy to maintain, you most likely will understand how the layout will look like just by looking at the source code.

You can whip up a pretty UI that is reasonable about aligning your elements into rows and columns automatically in no time.

Widgets

Medusa

Medusa is a JavaFX library for Gauges by Gerrit Grunwald. The main focus of this project is to provide Gauges that can be configured in multiple ways. It has beautiful widgets for reporting metrics, available under the Apache 2.0 License and if you’re doing any reporting, you should check it out.

TilesFX

TilesFX is another widget library by Gerrit, who is an amazing developer by the way. TilesFX offers you a set of tile widgets for all kinds of purposes, alarms, weather, data presentation so that you can create super fun dashboards.

JSilhouette

If you need to use custom shapes in your application, like maybe a star or a donut, or arrows, you can use JSilhouette. The shapes in the default JavaFX library are limited, and this is a very useful extension library.

JideFX

If you come from Swing, you might remember Jide – a framework for widgets like a formatted text field, or numeric text fields, together with the validation, and so on. Look no more; you can look into the JideFX, and get tooltips, animations, search widgets, all kinds of text controls.

RichTextFX

RichTextFX provides a text area for JavaFX with API to style ranges of text. It is intended as a base for rich-text editors and code editors with syntax highlighting. If you need to display complicatedly formatted text or have a custom syntax highlight, RichTextFX is the library to check out.

JFXtras

JFXtras is an open source library of components that a Java developer would like to have at their disposal, but which are missing from the JavaFX library. You can get calendar widgets, different sorts of date and time picker widgets, menus that pop up on click, and so on. If a component is not that mature yet it can temporarily reside in JFXtras-labs library, but after some time and exposure it will be promoted to the main one.

ControlsFX

You can think of ControlsFX as a playground or an incubator for the widgets that will be eventually integrated into the JavaFX. Currently, you can find widgets like the bread-crumb-bar, different button bars, decorators for the input fields for CSS, fonts and so on.

Gluon Maps

There isn’t that much to say about a map library, Gluon Maps provides a nice looking map controller. It has a dual licensing, GPL3 or a dual license that you can purchase and use it in a non-GPL3 app. The widget comes with a backend that knows how to feed the data information to your map. And you can use different backends for that: OpenStreetMap or such.

OrsonCharts

Finally, if you’re into charts you should check out OrsonCharts. It has a wide range of various charts that are better looking that the standard JavaFX solutions. It also has a dual license, so you should be careful not to overstep the licensing boundaries.

Looks

The great thing about JavaFX is that most widgets support custom styling with the CSS.

JFoenix

JFoenix is an implementation of the material design. It comes with a lot of components looking pretty close to the material design guidelines and all the required animations: sliding menus, flying in and out popups, color pickers and much much more.

BootstrapFX

Another look and feel library that you should consider using is the BootstrapFX. BootstrapFX is a partial port of Twitter Bootstrap for JavaFX. It provides a CSS stylesheet that closely resembles the original while being custom tailored for JavaFX’s unique CSS flavor.

FontawesomeFX

Fontawesome is a web icon font, providing tons of images to use on the elements to spice them up. Good thing is that the web icon fonts fit perfectly into JavaFX as it is lightweight and consisting of the scalable vector images. FontawesomeFX gives you access to fontawesome icons.

Ikonli

Ikonli is another project that deals with the icons. These also provide you access to font-awesome, developer icons, weather icons, etc. And what is even better if offers more possibilities to customize these, including stacked icons so that you can have an icon in a circle or something.

Testing

If you don’t have a lot of experience with JavaFX, you must be asking yourself, what is the best way to test your application and the components in it.

TestFX

TestFX is perhaps the most useful project aimed at testing JavaFX application. It comes with a nice DSL that embodies the UI interactions like clicks and drag & drop. Here’s an example of a test that comes from TestFX readme, see how readable the code is?

@Test
public void should_drag_file_into_trashcan() {
  // given:
  rightClickOn("#desktop").moveTo("New").clickOn("Text Document");
  write("myTextfile.txt").push(ENTER);

  // when:
  drag(".file").dropTo("#trash-can");

  // then:
  verifyThat("#desktop", hasChildren(0, ".file"));
}

Frameworks

As with any development platform, with JavaFX, you might have questions about what is the best architecture for your code. Where should you put your resources, how to tie together the controllers responsible for the business logic and the UI handling user actions, and so on. Luckily, there are several great JavaFX frameworks that give you different tradeoffs when answering JavaFX architecture questions.

Afterburner.fx

Afterburner.fx is an opinionated JavaFX framework created by Adam Bien, and previously a part of airhacks-control project. Afterburner is a “Just-Enough-Framework” that prefers convention over configuration and provides you with the following: “Zero-Configuration” javax.inject.Inject DI of models or services into presenters, convention-based unification of presenter, view, FXML and css; conventional resource bundle loading, and injection of the System properties and local configuration properties.

Afterburner is a very tiny framework, but it’s an amazing effort and a great starting point.

JacpFX

JacpFX is a UI application framework based on JavaFX, supporting developers to structure an application with loosely coupled, reusable components. It separates the task execution from UI changes in your client application, so you don’t hang the UI thread. JacpFX also includes a pre-configured event bus, so you can easily tie all your components together into a single system that communicates through asynchronous messages.

MvvmFX

MvvmFX is an application framework which provides you necessary components to implement the Model-View-ViewModel pattern with JavaFX.

Griffon

Griffon is desktop application development platform for the JVM. Heavily inspired by Grails, Griffon leverages the use of Groovy and convention over configuration. The Swing toolkit is the default UI toolkit of choice however others may be used, for example, JavaFX.
Griffon encourages the use of the Model-View-Controller architecture and encourages you to concentrate on your business logic.

Basilisk

Basilisk is similar to Griffon, but also targets mobile platforms. In a nutshell, Basilisk leverages JavaFX and JavafXPorts to bring the same codebase to desktop and mobile platforms alike.
Griffon developers should know their way around Basilisk as many of Griffon’s features and commands are shared with Basilisk.


The list of the libraries goes on and on. During the session, Andres also has looked at the platforms for JavaFX that can offer a full solution for developing your JavaFX app, and onto the general purpose libraries that have the bindings for JavaFX available: think reactive extensions in the form of RxJavaFx, ReactFX and so on.

So do go on and watch the session in full, Andres offers great explanations to why these JavaFX libraries and open source projects deserve your attention and gives other useful hints about them that can only come from lots and lots of experience of developing JavaFX applications.

The session is available in full on the Virtual JUG’s Youtube channel. Oh, and do yourself a favor, watch it in full!

After which if there’s any doubt about what JavaFX libraries or tools you should use, don’t be shy and ping Andres on Twitter: @aalmiray! While you’re at it, please say thanks to Andres for the amazing Virtual JUG session you’ve just watched and maybe share it with your friends too!


Read next: