Velocimeter

Overview

The Velocimeter represents a velocimeter gauge. The background and pointer can be customized. The text, max and min values can be drawn or not. The pointer's color can be changed

VelocimeterSample.java
  // Adds a timer
tt = addTimer(50);

  // Creates a simple Velocimeter
vel = new Velocimeter();
vel.value = -20;
vel.max = 40;
vel.pointerColor = Color.GREEN;
add(vel, CENTER, CENTER, PARENTSIZE + 50, PARENTSIZE + 50);

// Generates an event from the timer
@Override
public void onEvent(Event e)
{
	if (e.type == TimerEvent.TRIGGERED && tt.triggered)
	{
		vel.value++;
		if (vel.value > vel.max + 20)
		{
			vel.value = vel.min - 20;
		}
		repaint();
	}
}

To view the full code, click here.

Attributes

Methods

References

See the JavaDocs for more information.

Last updated