22 package com.realtime.crossfire.jxclient.gui.gauge;
27 import java.awt.Color;
29 import java.awt.Graphics;
30 import java.awt.Graphics2D;
31 import java.awt.Image;
32 import java.awt.geom.RectangularShape;
33 import org.jetbrains.annotations.NotNull;
34 import org.jetbrains.annotations.Nullable;
81 public GUIDupTextGauge(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final String
name, @NotNull
final Image pictureFullDiv,
final Image pictureFullMod, @NotNull
final Image pictureEmpty, @NotNull
final Orientation orientationDiv, @NotNull
final Orientation orientationMod, @Nullable
final String
tooltipPrefix, @NotNull
final Color color, @NotNull
final Font font, @Nullable
final CommandList commandList) {
82 super(tooltipManager, elementListener, name, pictureFullDiv, pictureFullMod, pictureEmpty, orientationDiv, orientationMod, tooltipPrefix, commandList);
92 super.paintComponent(g);
93 final Graphics2D g2 = (Graphics2D)g;
94 g2.setBackground(
new Color(0, 0, 0, 0.0f));
98 final RectangularShape rectangle = font.getStringBounds(text, g2.getFontRenderContext());
99 g2.drawString(text, (
int)Math.round((getWidth()-rectangle.getWidth())/2), (int)Math.round(getHeight()-rectangle.getMaxY()-rectangle.getMinY())/2);
106 public void setValues(
final int curValue,
final int minValue,
final int maxValue, @NotNull
final String labelText, @NotNull
final String
tooltipText) {
107 super.setValues(curValue, minValue, maxValue, labelText, tooltipText);
Listener for GUIElement related events.
final Font font
The text font.
final TooltipManager tooltipManager
The TooltipManager to update.
void setChanged()
Records that the contents have changed and must be repainted.
Interface for orientation images.
final CommandList commandList
The CommandList that is executed on button 2.
final GUIElementListener elementListener
The GUIElementListener to notify.
GUIDupTextGauge(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Image pictureFullDiv, final Image pictureFullMod, @NotNull final Image pictureEmpty, @NotNull final Orientation orientationDiv, @NotNull final Orientation orientationMod, @Nullable final String tooltipPrefix, @NotNull final Color color, @NotNull final Font font, @Nullable final CommandList commandList)
Creates a new instance.
final String name
The name of this element.
final Color color
The text color.
void paintComponent(@NotNull final Graphics g)
String tooltipText
The tooltip suffix.
final Orientation orientationMod
The gauge's orientation.
Displays a value as a graphical gauge that's filling state depends on the value.
final String tooltipPrefix
The tooltip prefix.
String labelText
The label text.
A list of GUICommand instances.
final Orientation orientationDiv
The gauge's orientation.
void setValues(final int curValue, final int minValue, final int maxValue, @NotNull final String labelText, @NotNull final String tooltipText)
Sets the values to display.the values to display the minimum possible value the maximum possible valu...
A GUIDupGauge which displays the current value as a text string on top of the gauge.
static final long serialVersionUID
The serial version UID.