here is another short blogpost about how to add some interactivity to your Medusa gauge.
Sometimes it could be useful to be able to have an additional button in a gauge to trigger some things like taking a screenshot, stop the communication, start a timer etc.
For these kind of things I've added the ability to press the knob in the following skin types
- Gauge (default)
To activate that feature you simply have to set the interactive property to true like you can see in the following code snippet...
Gauge gauge = GaugeBuilder.create() .skinType(SkinType.MODERN) .interactive(true) .onButtonPressed(e -> System.out.println("PRESSED")) .onButtonReleased(e -> System.out.println("RELEASED")) .build();
When you use this code you will see that you will be able to press the knob in the gauge and that it will print the corresponding text on the console. Pressing the button will also be visualized so that you get visual feedback in case you pressed the button.
Here is a litte screenshot that shows the two different states when using the Modern Skin...
And that's it, I hope you have some use for this feature and as always...keep coding...