image blog best javafx libraries
January 23, 2017

Best JavaFX Libraries for Beautiful Apps and Clean Code

Java Tools
Java Application Development

JavaFX is better when you use the right libraries. But which libraries should developers use for layout, widgets, appearance, and testing? In this article, we look at the JavaFX libraries from Andres Almiray's Virtual JUG session: The JavaFX Ecosystem.

The Best JavaFX Libraries and Frameworks

The JavaFX Exosystem 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.

 

Best JavaFX Layout Libraries

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.

Best JavaFX Widget Libraries

Medusa

image of Medusa Javafx library for gauges

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

screenshot of RichTextFX text area for JavaFX with API

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.

Try JRebel Free

Want to code faster, no matter your IDE or framework? Start your 14-day trial today.

Try Now

Best JavaFX Styling Libraries

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

JFoenix

screenshot of JFoenix material design components

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

screenshot of Ikonli icons

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.

Best JavaFX Testing Libraries

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"));
}

 

Best JavaFX 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 logo

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.


Final Thoughts

The list of the libraries goes on and on. Now you know some of the top Java Fx libraries and frameworks. What other Java technologies and tools are popular? See what's popular in our annual Java Developer Productivity Report. Grab a copy today by clicking the button below.

Get the Report