JavaFX and SteelSeries gauges using FXML

Gerrit Grunwald, aka @hansolo_ on twitter, has just ported his Swing based gauges and meters framework known as SteelSeries to JavaFX as part of the JFXtras-lab project. I can't tell you how many times since Java AWT first came out, that I have had to use meters and gauges in an application. Also, I can't count how many times I have found a dearth of open source gauge frameworks out there in the wild. Needless to say, I have been watching Gerrit's progress for several months now.  Finally, he posted his work to jxftras-lab and I have been eagerly testing ever since.

One area I wanted to see is if Gerrit's gauges worked with JavaFX FXML. JavaFX FXML is an XML-based language that provides the structure for building a user interface separate from the application logic of your code. With the numerous options that Gerrit's gauges support, this is a must have. I am happy to report with a little back and forth with Gerrit over a few days, we now have a working version that supports FXML. You'll have to download and build the latest jfxtras-lab bits from github, here.

Here is an FXML snippet showing how to define a Radial gauge in FXML. This matches Gerrit's blog, showing the same settings using Java code, here.

<Radial fx:id="radialGauge" prefWidth="280" prefHeight="280" title="Temperature" >
  <unit>°C</unit>
  <lcdDecimals>2</lcdDecimals>
  <frameDesign>STEEL</frameDesign>
  <backgroundDesign>DARK_GRAY</backgroundDesign>
  <lcdDesign>STANDARD_GREEN</lcdDesign>
  <lcdDecimals>2</lcdDecimals>
  <lcdValueFont>LCD</lcdValueFont>
  <pointerType>TYPE14</pointerType>
  <valueColor>RED</valueColor>
  <knobDesign>METAL</knobDesign>
  <knobColor>SILVER</knobColor>
  <sections>
    <Section start="0" stop="37" color="lime"/>
    <Section start="37" stop="60" color="yellow"/>
    <Section start="60" stop="75" color="orange"/>
  </sections>
  <sectionsVisible>true</sectionsVisible>
  <areas>
    <Section start="75" stop="100" color="red"/>
  </areas>
  <areasVisible>true</areasVisible>
  <markers>
    <Marker value="30" color="magenta"/>
    <Marker value="75" color="aquamarine"/>
  </markers>
  <markersVisible>true</markersVisible>
  <threshold>40</threshold>
  <thresholdVisible>true</thresholdVisible>
  <glowVisible>true</glowVisible>
  <glowOn>true</glowOn>
  <trendVisible>true</trendVisible>
  <trend>RISING</trend>
  <userLedVisible>true</userLedVisible>
  <bargraph>true</bargraph>
  <radialRange>RADIAL_300</radialRange>
  <GridPane.rowIndex>0</GridPane.rowIndex>
  <GridPane.columnIndex>0</GridPane.columnIndex>
  <GridPane.halignment>CENTER</GridPane.halignment>
  <GridPane.valignment>CENTER</GridPane.valignment>
</Radial>

 

This produced the following display:

In FXML, you create a Java controller class. For this simple example, in the controller class, Gauge.java, I created a JavaFX Timeline that iterates from the minimum to the maximum value over 10 seconds, alternating with rising and falling values. The actual Radial Gauge is represented by the "radialGauge" member of the controller that is annotated with @FXML. This allows the FXML system to match the actual JavaFX Radial Control instance to the controller member variable based on the FXML"fx:id" attribute. The initialize method of the controller class is called once the FXML system has processed the XML and created all the JavaFX Nodes.

The main JavaFX application is contained in the class SteelFX and it loads the FXML file then assigns it to the JavaFX Scene.

 

The complete code is here:

SteelFX.java

Gauge.fxml

Gauge.java

 

Views: 10784

Comment

You need to be a member of Codetown to add comments!

Join Codetown

Happy 10th year, JCertif!

Notes

Welcome to Codetown!

Codetown is a social network. It's got blogs, forums, groups, personal pages and more! You might think of Codetown as a funky camper van with lots of compartments for your stuff and a great multimedia system, too! Best of all, Codetown has room for all of your friends.

When you create a profile for yourself you get a personal page automatically. That's where you can be creative and do your own thing. People who want to get to know you will click on your name or picture and…
Continue

Created by Michael Levin Dec 18, 2008 at 6:56pm. Last updated by Michael Levin May 4, 2018.

Looking for Jobs or Staff?

Check out the Codetown Jobs group.

 

Enjoy the site? Support Codetown with your donation.



InfoQ Reading List

Presentation: Data Mesh in Action: A Journey From Ideation to Implementation

Anurag Kale discusses the transition from centralized data bottlenecks to a decentralized Data Mesh architecture at Horse Powertrain. He explains the four pillars - domain ownership, data as a product, self-serve platforms, and federated governance - to empower autonomous teams. Learn how to apply DDD and platform engineering to scale analytical value and align data strategy with business goals.

By Anurag Kale

Java News Roundup: JDK 26, LibericaJDK, Payara Platform, GlassFish Milestone, ClawRunr

This week's Java roundup for March 16th, 2026, features news highlighting: the GA release of JDK 26; LibericaJDK 26; the March 2026 edition of the Payara Platform; the first milestone release of GlassFish 9.0; a point release of Micronaut; and introducing ClawRunr, a new Java-based personal AI assistant created by JobRunr.

By Michael Redlich

Apple Improves Context Window Management for its Foundation Models

iOS 26.4, now in Release Candidate, introduces improved context window management for Apple's Foundation Models, helping developers work with the 4096-token context window limit. This encourages treating the context window as a constrained resource, which requires actively managing it like memory in a low-resource system to optimize its usage.

By Sergio De Simone

QCon London 2026: Fixing the AI Infra Scale Problem by Stuffing 1M Sandboxes in a Single Server

Unikraft CEO Felipe Huici demonstrated waking VM number one million on a commodity server in ten milliseconds at QCon London. The talk traced a decade from academic unikernel research to a platform offering stateless scale-to-zero VMs with full isolation. Using Firecracker and VM snapshots, sleeping workloads resume instantly, turning server density from a hardware problem into a scheduling one.

By Steef-Jan Wiggers

Spring News Roundup: Third Milestone Releases of Boot, Security, Integration, AI and AMQP

There was a flurry of activity in the Spring ecosystem during the week of March 16th, 2026, highlighting the third milestone releases of: Spring Boot, Spring Security, Spring Integration, Spring AI and Spring AMQP; along with the second milestone releases of Spring Data and Spring for Apache Kafka.

By Michael Redlich

© 2026   Created by Michael Levin.   Powered by

Badges  |  Report an Issue  |  Terms of Service