com.realtime.crossfire.jxclient.gui.gauge
Class GaugeState

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

public class GaugeState
extends java.lang.Object

The state of a gauge.


Field Summary
private  int dx
          The x-offset for drawing.
private  int dy
          The y-offset for drawing.
private  int filledH
          The height of the "filled" area.
private  java.awt.Image filledPicture
          The image for painting the "filled" area.
private  int filledW
          The width of the "filled" area.
private  int filledX
          The x-coordinate of the "filled" area.
private  int filledY
          The y-coordinate of the "filled" area.
private  java.awt.image.BufferedImage fullImage
          The image representing a full gauge.
private  java.awt.image.BufferedImage negativeImage
          The image representing a more-than-empty gauge.
 
Constructor Summary
GaugeState(java.awt.image.BufferedImage fullImage, java.awt.image.BufferedImage negativeImage, int dx, int dy)
          Creates a new instance.
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the gauge image into the given graphics context.
 boolean setValues(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
 

Field Detail

dx

private final int dx
The x-offset for drawing.


dy

private final int dy
The y-offset for drawing.


filledH

private int filledH
The height of the "filled" area.


filledPicture

@Nullable
private java.awt.Image filledPicture
The image for painting the "filled" area.


filledW

private int filledW
The width of the "filled" area.


filledX

private int filledX
The x-coordinate of the "filled" area.


filledY

private int filledY
The y-coordinate of the "filled" area.


fullImage

@Nullable
private final java.awt.image.BufferedImage fullImage
The image representing a full gauge.


negativeImage

@Nullable
private final java.awt.image.BufferedImage negativeImage
The image representing a more-than-empty gauge.

Constructor Detail

GaugeState

public GaugeState(@Nullable
                  java.awt.image.BufferedImage fullImage,
                  @Nullable
                  java.awt.image.BufferedImage 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

draw

public void draw(@NotNull
                 java.awt.Graphics g)
Draws the gauge image into the given graphics context.

Parameters:
g - the graphics context

setValues

public boolean setValues(@NotNull
                         Orientation orientation)
Updates the values from a Orientation state.

Parameters:
orientation - the state
Returns:
whether the state has changed