Monday, February 4, 2013

One class gauge...

Last week I prepared some things for my JFokus session and found a nice gauge on the web that looks like this...

It shows the temperature...wait a moment...the JavaFX app on my BeagleBoard also shows the temperature...why not use this gauge to visualize it. The gauge seems to be simple enough so that there should be no performance problems with the restricted resources of the BeagleBoard.
Long story is the result...

I used different colors for the sections because this colors look better on the lcd screen that is connected to my BeagleBoard. In addition I've also added an indicator that shows up if a given threshold is exceeded.
When you create a custom JavaFX control for the JDK7 implementation that runs on the BeagleBoard you can't use the 

  • Control
  • Skin
  • Behavior
  • css

approach because the control won't show up. So the solution is to create the complete control in one file which is totally fine for such a simple control.
And that's exactly what I did and now I could use this control on my BeagleBoard JavaFX app to show the measured temperature.
One could define the sections with their colors, a min- and max-value and a threshold for the gauge. The tickmark implementation is really simple and won't really work with large ranges, so for me it works out and if you would like to use that thing by yourself...feel free to fork it on github.

That's all for coding...

No comments:

Post a Comment