23 package com.realtime.crossfire.jxclient.gui.gauge;
32 import java.awt.AlphaComposite;
33 import java.awt.Dimension;
34 import java.awt.Graphics;
35 import java.awt.Graphics2D;
36 import java.awt.Image;
37 import java.awt.event.MouseEvent;
38 import org.jetbrains.annotations.NotNull;
39 import org.jetbrains.annotations.Nullable;
126 public GUIGauge(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final String
name, @Nullable
final Image fullImage, @Nullable
final Image lowImage, @Nullable
final Image negativeImage, @Nullable
final Image
emptyImage, @NotNull
final Orientation orientation, @Nullable
final String
tooltipFormat,
final float alpha, @Nullable
final CommandList commandList, @NotNull
final GuiFactory guiFactory, @NotNull
final Stats stats) {
142 public void setBounds(
final int x,
final int y,
final int width,
final int height) {
143 super.setBounds(x, y, width, height);
157 final Graphics paint;
159 final Graphics2D g2d = (Graphics2D)g.create();
160 g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
alpha));
166 super.paintComponent(paint);
177 public void setValues(
final int curValue,
final int minValue,
final int maxValue, @NotNull
final String labelText, @NotNull
final String
tooltipText) {
193 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
200 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
207 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
219 super.mouseClicked(e);
225 switch (e.getButton()) {
226 case MouseEvent.BUTTON1:
229 case MouseEvent.BUTTON2:
235 case MouseEvent.BUTTON3:
265 final StringBuilder sb =
new StringBuilder();
268 while (i < formatChars.length) {
269 final char ch = formatChars[i++];
270 if (ch !=
'%' || i >= formatChars.length) {
273 switch (formatChars[i++]) {
288 sb.append(formatChars[i-1]);
293 return sb.toString();