Class Velocimeter


  • public class Velocimeter
    extends Container
    This class 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.
    • Field Detail

      • value

        public int value
        The current value
      • max

        public int max
        The maximum value; defaults to 100
      • min

        public int min
        The minimum value; defaults to 0
      • pointerColor

        public int pointerColor
        The pointer's color
      • valueColor

        public int valueColor
        The value's color
      • drawMin

        public boolean drawMin
        Set to false to don't draw the min value's text
      • drawMax

        public boolean drawMax
        Set to false to don't draw the max value's text
      • drawValue

        public boolean drawValue
        Set to false to don't draw the value's text
      • maxAngle

        public int maxAngle
        The maximum angle value; defaults to 270 for the default gauge
    • Constructor Detail

      • Velocimeter

        public Velocimeter()
        Constructs a velocimeter using the default gauge and pointer images
      • Velocimeter

        public Velocimeter​(java.lang.String gaugeImagePath,
                           java.lang.String pointerImagePath)
        Constructs a velocimeter using the given images. Note that the pointer should be all-white so it can be correctly colorized, and it must also be pointing to the gauge's position 0. Both images must be squared.
    • Method Detail

      • initUI

        public void initUI()
        Description copied from class: Container
        Called to initialize the User Interface of this container. This differs from the onAddAgain method by that this method is called only once, at the first time the control is added to the parent. When the container is being setup, the initUI method is called; then, the onAddAgain is called every time the container is added again.
        Overrides:
        initUI in class Container
      • onPaint

        public void onPaint​(Graphics g)
        Description copied from class: Container
        Draws the border (if any). If you override this method, be sure to call super.onPaint(g);, or the border will not be drawn.
        Overrides:
        onPaint in class Container
        Parameters:
        g - the graphics object for drawing
        See Also:
        Graphics