Class PrivBotOverlayPanel<S>

java.lang.Object
net.runelite.client.ui.overlay.Overlay
net.runelite.client.ui.overlay.OverlayPanel
privbot.ui.overlay.PrivBotOverlayPanel<S>
Type Parameters:
S - the tick-published state (see Snapshot)
All Implemented Interfaces:
net.runelite.client.ui.overlay.components.LayoutableRenderableEntity, net.runelite.client.ui.overlay.RenderableEntity

public abstract class PrivBotOverlayPanel<S> extends net.runelite.client.ui.overlay.OverlayPanel
A themed HUD panel composed from a published state on every render.

Subclass and implement compose(Rows, Object), or build one with PrivBotOverlays.panel(String). The panel applies OverlayTheme (card colour, width, title) itself, renders nothing while hidden or while the state supplier returns null, and never touches the client: everything it shows comes from S.

Each panel carries its own width, text scale and background opacity; the background is re-applied from that opacity on every frame, so a translucent panel stays translucent.

  • Field Summary

    Fields inherited from class net.runelite.client.ui.overlay.OverlayPanel

    panelComponent

    Fields inherited from class net.runelite.client.ui.overlay.Overlay

    PRIORITY_DEFAULT, PRIORITY_HIGH, PRIORITY_HIGHEST, PRIORITY_LOW, PRIORITY_MED
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The background this panel paints with (re-applied on every frame).
    protected abstract void
    compose(Rows rows, S state)
    The rows for this render; called only with a non-null state.
    opacity(int percent)
    Background opacity in percent (clamped 0..100); colour stays OverlayTheme.CARD_BG's.
    render(Graphics2D graphics)
    Render-thread entry: reads the visibility condition and the state, composes the rows and paints them.
    protected S
    The state for this render (the constructor's supplier unless a subclass supplies it).
    double
    The text scale (1.0 = the client's overlay font).
    textScale(double scale)
    Text size relative to the client's overlay font (1.0 = unchanged).
    The title given to the constructor.
    protected String
    titleFor(S state)
    The title shown for state; the constructor's title unless a subclass names one per state.
    Hide the panel while condition is false (typically plugin::isEnabled).
    int
    The panel width in pixels.
    width(int px)
    Sets the panel width in pixels (at least 80).

    Methods inherited from class net.runelite.client.ui.overlay.OverlayPanel

    getPanelComponent, getPreferredColor, isClearChildren, isDynamicFont, setClearChildren, setDynamicFont, setPreferredColor

    Methods inherited from class net.runelite.client.ui.overlay.Overlay

    addMenuEntry, addMenuEntry, drawAfterInterface, drawAfterLayer, drawAfterLayer, drawAfterLayer, getBounds, getDrawHooks, getLayer, getMenuEntries, getMinimumSize, getName, getParentBounds, getPlugin, getPosition, getPreferredLocation, getPreferredPosition, getPreferredSize, getPriority, isDragTargetable, isMovable, isResettable, isResizable, isSnappable, onDrag, onMouseOver, removeMenuEntry, revalidate, setBounds, setDragTargetable, setLayer, setMinimumSize, setMovable, setPosition, setPreferredLocation, setPreferredPosition, setPreferredSize, setPriority, setPriority, setResettable, setResizable, setSnappable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PrivBotOverlayPanel

      protected PrivBotOverlayPanel(String title, Supplier<S> state)
      Parameters:
      title - the panel title (gold); null or empty shows none
      state - the published state, usually a Snapshot; read on the render thread
  • Method Details

    • compose

      protected abstract void compose(Rows rows, S state)
      The rows for this render; called only with a non-null state.
    • visibleWhen

      public PrivBotOverlayPanel<S> visibleWhen(BooleanSupplier condition)
      Hide the panel while condition is false (typically plugin::isEnabled).
    • width

      public PrivBotOverlayPanel<S> width(int px)
      Sets the panel width in pixels (at least 80).
    • width

      public int width()
      The panel width in pixels.
    • opacity

      public PrivBotOverlayPanel<S> opacity(int percent)
      Background opacity in percent (clamped 0..100); colour stays OverlayTheme.CARD_BG's.
    • background

      public Color background()
      The background this panel paints with (re-applied on every frame).
    • textScale

      public PrivBotOverlayPanel<S> textScale(double scale)
      Text size relative to the client's overlay font (1.0 = unchanged).
    • textScale

      public double textScale()
      The text scale (1.0 = the client's overlay font).
    • title

      public String title()
      The title given to the constructor.
    • state

      protected S state()
      The state for this render (the constructor's supplier unless a subclass supplies it).
    • titleFor

      protected String titleFor(S state)
      The title shown for state; the constructor's title unless a subclass names one per state.
    • render

      public Dimension render(Graphics2D graphics)
      Render-thread entry: reads the visibility condition and the state, composes the rows and paints them. Draws nothing while hidden, when the state is null, or when no row was added. Subclasses implement compose(privbot.ui.overlay.Rows, S) rather than overriding this.
      Specified by:
      render in interface net.runelite.client.ui.overlay.RenderableEntity
      Overrides:
      render in class net.runelite.client.ui.overlay.OverlayPanel