Class GaugeState

java.lang.Object
com.realtime.crossfire.jxclient.gui.gauge.GaugeState

public class GaugeState extends Object
The state of a gauge.
  • Constructor Details

    • GaugeState

      public GaugeState(@Nullable @Nullable Image fullImage, @Nullable @Nullable Image lowImage, @Nullable @Nullable Image negativeImage, int dx, int dy)
      Creates a new instance.
      Parameters:
      fullImage - the image representing a full gauge
      lowImage - the image representing a low gaueg (<30%)
      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 Details

    • 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 Graphics g)
      Draws the gauge image into the given graphics context.
      Parameters:
      g - the graphics context
    • getPreferredSize

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