Class GUIDupGauge

All Implemented Interfaces:
GUIGaugeListener, GUIElement, ImageObserver, MenuContainer, Serializable

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

    • GUIDupGauge

      public GUIDupGauge(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, @NotNull @NotNull Image fullImageDiv, @NotNull @NotNull Image fullImageMod, @Nullable @Nullable Image emptyImage, @NotNull @NotNull Orientation orientationDiv, @NotNull @NotNull Orientation orientationMod, @Nullable @Nullable String tooltipPrefix, @NotNull @NotNull Color color, @NotNull @NotNull Font font, @Nullable @Nullable CommandList commandList, @NotNull @NotNull GuiFactory guiFactory)
      Creates a new instance.
      Parameters:
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      name - the name of this element
      fullImageDiv - the top image
      fullImageMod - the bottom image
      emptyImage - the image representing an empty gauge; if set to null an empty background is used instead
      orientationDiv - the gauge's orientation
      orientationMod - the gauge's orientation
      tooltipPrefix - the prefix for displaying tooltips; if set to null no tooltips are shown
      color - the text color
      font - the text font
      commandList - the command list that is executed on button 2
      guiFactory - the global GUI factory instance
  • Method Details

    • paintComponent

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

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

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

      @NotNull public @NotNull Dimension getMaximumSize()
      Overrides:
      getMaximumSize 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
    • setBounds

      public void setBounds(int x, int y, int width, int height)
      Overrides:
      setBounds in class Component
    • 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