public class GaugeState
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
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 |
fullImage
The image representing a full gauge.
|
private java.awt.Image |
negativeImage
The image representing a more-than-empty gauge.
|
private java.awt.Dimension |
preferredSize
The preferred size of this component.
|
Constructor and Description |
---|
GaugeState(java.awt.Image fullImage,
java.awt.Image negativeImage,
int dx,
int dy)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics g)
Draws the gauge image into the given graphics context.
|
java.awt.Dimension |
getPreferredSize()
Returns the preferred size.
|
void |
setDy(int dy)
Sets the y-offset for drawing.
|
boolean |
setValues(Orientation orientation)
Updates the values from a
Orientation state. |
private final int dx
private int dy
private int filledH
@Nullable private java.awt.Image filledPicture
private int filledW
private int filledX
private int filledY
@Nullable private final java.awt.Image fullImage
@Nullable private final java.awt.Image negativeImage
@NotNull private final java.awt.Dimension preferredSize
public GaugeState(@Nullable java.awt.Image fullImage, @Nullable java.awt.Image negativeImage, int dx, int dy)
fullImage
- the image representing a full gaugenegativeImage
- the image representing a more-than-empty gauge; if
set to null
the gauge remains in empty statedx
- the x-offset for drawingdy
- the y-offset for drawingpublic void draw(@NotNull java.awt.Graphics g)
g
- the graphics context@NotNull public java.awt.Dimension getPreferredSize()
public void setDy(int dy)
dy
- the y-offset for drawingpublic boolean setValues(@NotNull Orientation orientation)
Orientation
state.orientation
- the state