JavaFX controls follow the MVC pattern, which allows multiple views for the same model. Therefore, multiple Skins can be provided for a Control. A good example is the Medusa library, which offers a gauge control with about 30 different skins.

I wanted to play a bit with JavaFX controls and skins, so I decided to write my own gauge control. My goal was to keep the code simple and easy to understand, underlining the separation between model (the gauge) and views (the skins). The result is the JFXGauge library.

JFXGauge provides only two skins. The first one is probably the most simple skin you can think of. It consists only of a Text component. However, using CSS styling you can customize even this skin in many interesting ways:
text skin
(click for animated gif)

The second skin is a thermometer skin and is more complex:
thermo skin
(click for animated gif)

For this skin I also defined a few styleable properties that allow configuring the thermometer’s aspect ratio and the position of the range and threshold markings. Implementing styleable properties involves writing boilerplate code, but Hendrik Ebbers’ CSS Helper reduces the amount needed.

JFXGauge is available in Maven Central and JCenter.

Try the demo application included in the latest release, read the documentation and use the gauge in your projects!