Class GaugeState


  • public class GaugeState
    extends java.lang.Object
    The state of a gauge.
    • Constructor Summary

      Constructors 
      Constructor Description
      GaugeState​(@Nullable java.awt.Image fullImage, @Nullable java.awt.Image negativeImage, int dx, int dy)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void draw​(@NotNull java.awt.Graphics g)
      Draws the gauge image into the given graphics context.
      @NotNull java.awt.Dimension getPreferredSize()
      Returns the preferred size.
      void setDy​(int dy)
      Sets the y-offset for drawing.
      boolean setValues​(@NotNull Orientation orientation)
      Updates the values from a Orientation state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GaugeState

        public GaugeState​(@Nullable
                          @Nullable java.awt.Image fullImage,
                          @Nullable
                          @Nullable java.awt.Image negativeImage,
                          int dx,
                          int dy)
        Creates a new instance.
        Parameters:
        fullImage - the image representing a full gauge
        negativeImage - the image representing a more-than-empty gauge; if set to null the gauge remains in empty state
        dx - the x-offset for drawing
        dy - the y-offset for drawing
    • Method Detail

      • setDy

        public void setDy​(int dy)
        Sets the y-offset for drawing.
        Parameters:
        dy - the y-offset for drawing
      • setValues

        public boolean setValues​(@NotNull
                                 @NotNull Orientation orientation)
        Updates the values from a Orientation state.
        Parameters:
        orientation - the state
        Returns:
        whether the state has changed
      • draw

        public void draw​(@NotNull
                         @NotNull java.awt.Graphics g)
        Draws the gauge image into the given graphics context.
        Parameters:
        g - the graphics context
      • getPreferredSize

        @NotNull
        public @NotNull java.awt.Dimension getPreferredSize()
        Returns the preferred size.
        Returns:
        the preferred size