All Implemented Interfaces:
GUIGaugeListener, GUIElement, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
GUITextGauge

public class GUIGauge extends AbstractGUIElement implements GUIGaugeListener
Displays a value as a graphical gauge that's filling state depends on the value.
See Also:
  • Constructor Details

    • GUIGauge

      public GUIGauge(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, @Nullable @Nullable Image fullImage, @Nullable @Nullable Image lowImage, @Nullable @Nullable Image negativeImage, @Nullable @Nullable Image emptyImage, @NotNull @NotNull Orientation orientation, @Nullable @Nullable String tooltipFormat, float alpha, @Nullable @Nullable CommandList commandList, @NotNull @NotNull GuiFactory guiFactory, @NotNull @NotNull Stats stats)
      Creates a new instance.
      Parameters:
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      name - the name of this element
      fullImage - the image representing a full gauge
      lowImage - the image representing a low gauge (<30%)
      negativeImage - the image representing a more-than-empty gauge; if set to null the gauge remains in empty state
      emptyImage - the image representing an empty gauge; if set to null an empty background is used instead
      orientation - the gauge's orientation
      tooltipFormat - the format for displaying tooltips; if set to null no tooltips are shown
      alpha - alpha value of the gauge to use
      commandList - the command list that is executed on button 2
      guiFactory - the global GUI factory instance
      stats - the stats instance to use
  • Method Details

    • setBounds

      public void setBounds(int x, int y, int width, int height)
      Overrides:
      setBounds in class Component
    • paintComponent

      public void paintComponent(@NotNull @NotNull Graphics g)
      Overrides:
      paintComponent in class JComponent
    • setValues

      public void setValues(int curValue, int minValue, int maxValue, @NotNull @NotNull String labelText, @NotNull @NotNull String tooltipText)
      Description copied from interface: GUIGaugeListener
      Sets the values to display.
      Specified by:
      setValues in interface GUIGaugeListener
      Parameters:
      curValue - the values to display
      minValue - the minimum possible value
      maxValue - the maximum possible value
      labelText - the label text
      tooltipText - the tooltip suffix
    • getPreferredSize

      @Nullable public @Nullable Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      @Nullable public @Nullable Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • getMaximumSize

      @Nullable public @Nullable Dimension getMaximumSize()
      Overrides:
      getMaximumSize in class JComponent
    • setHidden

      public void setHidden(boolean hidden)
      Description copied from interface: GUIGaugeListener
      Specify whether this item should hide itself, independent of the "visibility" state.
      Specified by:
      setHidden in interface GUIGaugeListener
      Parameters:
      hidden - whether the gauge is hidden
    • mouseClicked

      public void mouseClicked(@NotNull @NotNull MouseEvent e)
      Description copied from interface: GUIElement
      Will be called when the user has clicked (pressed+released) this element. This event will be delivered after GUIElement.mouseReleased(MouseEvent).
      Specified by:
      mouseClicked in interface GUIElement
      Overrides:
      mouseClicked in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • getTooltip

      @Nullable public @Nullable TooltipText getTooltip()
      Description copied from class: AbstractGUIElement
      Returns the current tooltip text.
      Specified by:
      getTooltip in class AbstractGUIElement
      Returns:
      the tooltip text or null to not show a tooltip
    • notifyOpen

      public void notifyOpen()
      Description copied from interface: GUIElement
      Called each time the enclosing dialog is opened (or raised).
      Specified by:
      notifyOpen in interface GUIElement