Interface IWidget

All Superinterfaces:
Identifiable, Interactable, RuneLiteWrapper<net.runelite.api.widgets.Widget>, net.runelite.api.widgets.Widget

public interface IWidget extends net.runelite.api.widgets.Widget, Interactable, Identifiable, RuneLiteWrapper<net.runelite.api.widgets.Widget>
Represents a UI widget (interface component) in the game.

Widgets are the building blocks of the game's user interface. Everything from the inventory grid to dialog boxes to the minimap are composed of widgets. Widgets can contain:

  • Text and formatted strings
  • Sprites and images
  • 3D models (for item icons)
  • Child widgets (hierarchical structure)

Widgets are identified by a group ID and component ID. The packed format combines these: packedId = (groupId << 16) | componentId.

Example usage:

 
 IWidgets widgets = Static.getWidgets();
 IWidget closeButton = widgets.get(12, 3, 11);
 if (closeButton != null && closeButton.isVisible()) {
     closeButton.click();
 }
 
 

See Also:
  • Method Details

    • getDynamicChildren

      IWidget[] getDynamicChildren()
      Gets the dynamically created child widgets.

      Dynamic children are created at runtime (e.g., inventory item slots).

      Specified by:
      getDynamicChildren in interface net.runelite.api.widgets.Widget
      Returns:
      array of dynamic children, or null if none
    • getStaticChildren

      IWidget[] getStaticChildren()
      Gets the statically defined child widgets.

      Static children are defined in the interface definition.

      Specified by:
      getStaticChildren in interface net.runelite.api.widgets.Widget
      Returns:
      array of static children, or null if none
    • getNestedChildren

      IWidget[] getNestedChildren()
      Gets nested child widgets.
      Specified by:
      getNestedChildren in interface net.runelite.api.widgets.Widget
      Returns:
      array of nested children, or null if none
    • setText

      IWidget setText(String text)
      Sets the displayed text of this widget.
      Specified by:
      setText in interface net.runelite.api.widgets.Widget
      Parameters:
      text - the text to display
      Returns:
      this widget for chaining
    • setTextColor

      IWidget setTextColor(int textColor)
      Sets the text color of this widget.
      Specified by:
      setTextColor in interface net.runelite.api.widgets.Widget
      Parameters:
      textColor - the color in RGB format (0xRRGGBB)
      Returns:
      this widget for chaining
    • setOpacity

      IWidget setOpacity(int transparency)
      Sets the opacity (transparency) of this widget.
      Specified by:
      setOpacity in interface net.runelite.api.widgets.Widget
      Parameters:
      transparency - 0 = fully opaque, 255 = fully transparent
      Returns:
      this widget for chaining
    • setName

      IWidget setName(String name)
      Sets the name of this widget (used for menu actions).
      Specified by:
      setName in interface net.runelite.api.widgets.Widget
      Parameters:
      name - the widget name
      Returns:
      this widget for chaining
    • setModelId

      IWidget setModelId(int id)
      Sets the 3D model ID to display.
      Specified by:
      setModelId in interface net.runelite.api.widgets.Widget
      Parameters:
      id - the model ID
      Returns:
      this widget for chaining
    • setModelType

      IWidget setModelType(int type)
      Sets the model type.
      Specified by:
      setModelType in interface net.runelite.api.widgets.Widget
      Parameters:
      type - the model type
      Returns:
      this widget for chaining
    • setAnimationId

      IWidget setAnimationId(int animationId)
      Sets the animation to play on the model.
      Specified by:
      setAnimationId in interface net.runelite.api.widgets.Widget
      Parameters:
      animationId - the animation ID
      Returns:
      this widget for chaining
    • setRotationX

      IWidget setRotationX(int modelX)
      Sets the X-axis rotation of the model.
      Specified by:
      setRotationX in interface net.runelite.api.widgets.Widget
      Parameters:
      modelX - the X rotation
      Returns:
      this widget for chaining
    • setRotationY

      IWidget setRotationY(int modelY)
      Sets the Y-axis rotation of the model.
      Specified by:
      setRotationY in interface net.runelite.api.widgets.Widget
      Parameters:
      modelY - the Y rotation
      Returns:
      this widget for chaining
    • setRotationZ

      IWidget setRotationZ(int modelZ)
      Sets the Z-axis rotation of the model.
      Specified by:
      setRotationZ in interface net.runelite.api.widgets.Widget
      Parameters:
      modelZ - the Z rotation
      Returns:
      this widget for chaining
    • setModelZoom

      IWidget setModelZoom(int modelZoom)
      Sets the zoom level for the model.
      Specified by:
      setModelZoom in interface net.runelite.api.widgets.Widget
      Parameters:
      modelZoom - the zoom level
      Returns:
      this widget for chaining
    • setSpriteId

      IWidget setSpriteId(int spriteId)
      Sets the sprite (image) ID to display.
      Specified by:
      setSpriteId in interface net.runelite.api.widgets.Widget
      Parameters:
      spriteId - the sprite ID
      Returns:
      this widget for chaining
    • setSpriteTiling

      IWidget setSpriteTiling(boolean tiling)
      Sets whether the sprite should tile to fill the widget.
      Specified by:
      setSpriteTiling in interface net.runelite.api.widgets.Widget
      Parameters:
      tiling - true to tile, false to stretch
      Returns:
      this widget for chaining
    • setHidden

      IWidget setHidden(boolean hidden)
      Sets whether this widget is hidden.
      Specified by:
      setHidden in interface net.runelite.api.widgets.Widget
      Parameters:
      hidden - true to hide, false to show
      Returns:
      this widget for chaining
    • setItemId

      IWidget setItemId(int itemId)
      Sets the item ID for item display widgets.
      Specified by:
      setItemId in interface net.runelite.api.widgets.Widget
      Parameters:
      itemId - the item ID
      Returns:
      this widget for chaining
    • setItemQuantity

      IWidget setItemQuantity(int quantity)
      Sets the item quantity for item display widgets.
      Specified by:
      setItemQuantity in interface net.runelite.api.widgets.Widget
      Parameters:
      quantity - the quantity to display
      Returns:
      this widget for chaining
    • setScrollX

      IWidget setScrollX(int scrollX)
      Sets the horizontal scroll position.
      Specified by:
      setScrollX in interface net.runelite.api.widgets.Widget
      Parameters:
      scrollX - the X scroll offset
      Returns:
      this widget for chaining
    • setScrollY

      IWidget setScrollY(int scrollY)
      Sets the vertical scroll position.
      Specified by:
      setScrollY in interface net.runelite.api.widgets.Widget
      Parameters:
      scrollY - the Y scroll offset
      Returns:
      this widget for chaining
    • setScrollWidth

      IWidget setScrollWidth(int width)
      Sets the scrollable content width.
      Specified by:
      setScrollWidth in interface net.runelite.api.widgets.Widget
      Parameters:
      width - the scroll width
      Returns:
      this widget for chaining
    • setScrollHeight

      IWidget setScrollHeight(int height)
      Sets the scrollable content height.
      Specified by:
      setScrollHeight in interface net.runelite.api.widgets.Widget
      Parameters:
      height - the scroll height
      Returns:
      this widget for chaining
    • setOriginalX

      IWidget setOriginalX(int originalX)
      Sets the original X position.
      Specified by:
      setOriginalX in interface net.runelite.api.widgets.Widget
      Parameters:
      originalX - the X position
      Returns:
      this widget for chaining
    • setOriginalY

      IWidget setOriginalY(int originalY)
      Sets the original Y position.
      Specified by:
      setOriginalY in interface net.runelite.api.widgets.Widget
      Parameters:
      originalY - the Y position
      Returns:
      this widget for chaining
    • setPos

      IWidget setPos(int x, int y)
      Sets the widget position.
      Specified by:
      setPos in interface net.runelite.api.widgets.Widget
      Parameters:
      x - the X position
      y - the Y position
      Returns:
      this widget for chaining
    • setPos

      IWidget setPos(int x, int y, int xMode, int yMode)
      Sets the widget position with positioning modes.
      Specified by:
      setPos in interface net.runelite.api.widgets.Widget
      Parameters:
      x - the X position
      y - the Y position
      xMode - the X positioning mode
      yMode - the Y positioning mode
      Returns:
      this widget for chaining
    • setOriginalHeight

      IWidget setOriginalHeight(int originalHeight)
      Sets the original height.
      Specified by:
      setOriginalHeight in interface net.runelite.api.widgets.Widget
      Parameters:
      originalHeight - the height
      Returns:
      this widget for chaining
    • setOriginalWidth

      IWidget setOriginalWidth(int originalWidth)
      Sets the original width.
      Specified by:
      setOriginalWidth in interface net.runelite.api.widgets.Widget
      Parameters:
      originalWidth - the width
      Returns:
      this widget for chaining
    • setSize

      IWidget setSize(int width, int height)
      Sets the widget size.
      Specified by:
      setSize in interface net.runelite.api.widgets.Widget
      Parameters:
      width - the width
      height - the height
      Returns:
      this widget for chaining
    • setSize

      IWidget setSize(int width, int height, int widthMode, int heightMode)
      Sets the widget size with sizing modes.
      Specified by:
      setSize in interface net.runelite.api.widgets.Widget
      Parameters:
      width - the width
      height - the height
      widthMode - the width sizing mode
      heightMode - the height sizing mode
      Returns:
      this widget for chaining
    • createChild

      IWidget createChild(int index, int type)
      Creates a child widget at a specific index.
      Specified by:
      createChild in interface net.runelite.api.widgets.Widget
      Parameters:
      index - the child index
      type - the widget type
      Returns:
      the created child widget
    • createChild

      IWidget createChild(int type)
      Creates a child widget at the next available index.
      Specified by:
      createChild in interface net.runelite.api.widgets.Widget
      Parameters:
      type - the widget type
      Returns:
      the created child widget
    • setHasListener

      IWidget setHasListener(boolean hasListener)
      Sets whether this widget has an action listener.
      Specified by:
      setHasListener in interface net.runelite.api.widgets.Widget
      Parameters:
      hasListener - true if it has a listener
      Returns:
      this widget for chaining
    • setFontId

      IWidget setFontId(int id)
      Sets the font ID for text rendering.
      Specified by:
      setFontId in interface net.runelite.api.widgets.Widget
      Parameters:
      id - the font ID
      Returns:
      this widget for chaining
    • setTextShadowed

      IWidget setTextShadowed(boolean shadowed)
      Sets whether text should have a shadow.
      Specified by:
      setTextShadowed in interface net.runelite.api.widgets.Widget
      Parameters:
      shadowed - true for shadowed text
      Returns:
      this widget for chaining
    • setItemQuantityMode

      IWidget setItemQuantityMode(int itemQuantityMode)
      Sets the item quantity display mode.
      Specified by:
      setItemQuantityMode in interface net.runelite.api.widgets.Widget
      Parameters:
      itemQuantityMode - the display mode
      Returns:
      this widget for chaining
    • setXPositionMode

      IWidget setXPositionMode(int xpm)
      Sets the X position mode.
      Specified by:
      setXPositionMode in interface net.runelite.api.widgets.Widget
      Parameters:
      xpm - the X position mode
      Returns:
      this widget for chaining
    • setYPositionMode

      IWidget setYPositionMode(int ypm)
      Sets the Y position mode.
      Specified by:
      setYPositionMode in interface net.runelite.api.widgets.Widget
      Parameters:
      ypm - the Y position mode
      Returns:
      this widget for chaining
    • setLineHeight

      IWidget setLineHeight(int lineHeight)
      Sets the line height for multi-line text.
      Specified by:
      setLineHeight in interface net.runelite.api.widgets.Widget
      Parameters:
      lineHeight - the line height
      Returns:
      this widget for chaining
    • setXTextAlignment

      IWidget setXTextAlignment(int xta)
      Sets the horizontal text alignment.
      Specified by:
      setXTextAlignment in interface net.runelite.api.widgets.Widget
      Parameters:
      xta - the X text alignment
      Returns:
      this widget for chaining
    • setYTextAlignment

      IWidget setYTextAlignment(int yta)
      Sets the vertical text alignment.
      Specified by:
      setYTextAlignment in interface net.runelite.api.widgets.Widget
      Parameters:
      yta - the Y text alignment
      Returns:
      this widget for chaining
    • setWidthMode

      IWidget setWidthMode(int widthMode)
      Sets the width sizing mode.
      Specified by:
      setWidthMode in interface net.runelite.api.widgets.Widget
      Parameters:
      widthMode - the width mode
      Returns:
      this widget for chaining
    • setHeightMode

      IWidget setHeightMode(int heightMode)
      Sets the height sizing mode.
      Specified by:
      setHeightMode in interface net.runelite.api.widgets.Widget
      Parameters:
      heightMode - the height mode
      Returns:
      this widget for chaining
    • setFilled

      IWidget setFilled(boolean filled)
      Sets whether shapes should be filled.
      Specified by:
      setFilled in interface net.runelite.api.widgets.Widget
      Parameters:
      filled - true to fill shapes
      Returns:
      this widget for chaining
    • getParent

      IWidget getParent()
      Gets the parent widget.
      Specified by:
      getParent in interface net.runelite.api.widgets.Widget
      Returns:
      the parent widget, or null if this is a root widget
    • getDragParent

      IWidget getDragParent()
      Gets the drag parent widget.
      Specified by:
      getDragParent in interface net.runelite.api.widgets.Widget
      Returns:
      the drag parent
    • setDragParent

      IWidget setDragParent(net.runelite.api.widgets.Widget dragParent)
      Sets the drag parent widget.
      Specified by:
      setDragParent in interface net.runelite.api.widgets.Widget
      Parameters:
      dragParent - the drag parent
      Returns:
      this widget for chaining
    • getChild

      IWidget getChild(int index)
      Gets a child widget by index.
      Specified by:
      getChild in interface net.runelite.api.widgets.Widget
      Parameters:
      index - the child index
      Returns:
      the child widget, or null if not found
    • getChildren

      IWidget[] getChildren()
      Gets all child widgets.
      Specified by:
      getChildren in interface net.runelite.api.widgets.Widget
      Returns:
      array of child widgets, or null if none
    • setChildren

      void setChildren(net.runelite.api.widgets.Widget[] children)
      Sets the child widgets.
      Specified by:
      setChildren in interface net.runelite.api.widgets.Widget
      Parameters:
      children - the child widgets
    • isVisible

      boolean isVisible()
      Checks if this widget is currently visible on screen.

      A widget is visible if it and all its parents are not hidden and the interface is open.

      Returns:
      true if visible
    • click

      void click()
      Clicks this widget.

      This performs a left-click interaction on the widget.