Class TableComponent

java.lang.Object
net.storm.api.ui.TableComponent
All Implemented Interfaces:
net.runelite.client.ui.overlay.components.LayoutableRenderableEntity, net.runelite.client.ui.overlay.RenderableEntity

public class TableComponent extends Object implements net.runelite.client.ui.overlay.components.LayoutableRenderableEntity
A renderable table component for displaying tabular data in overlays.

This component supports multiple columns and rows with configurable alignment, colors, and automatic text wrapping. It implements LayoutableRenderableEntity for use within RuneLite's overlay system.

Features:

  • Automatic column width calculation based on content
  • Word wrapping for long text content
  • Configurable alignment (left, center, right) per cell, row, column, or table
  • Configurable colors per cell, row, column, or table
  • Priority cascade: cell settings override row, row overrides column, column overrides table defaults

Example usage:

 TableComponent table = new TableComponent();
 table.setColumns("Name", "Value", "Status");
 table.addRow("Item 1", "100", "Active");
 table.addRow("Item 2", "200", "Inactive");
 

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds multiple column headers as TableElement objects.
    void
    addRow(String... cells)
    Adds a row with the specified cell contents as strings.
    void
    addRows(TableRow... rows)
    Adds multiple pre-built TableRow objects to the table.
    boolean
    Checks if the table has no data to display.
    render(Graphics2D graphics)
    Renders the table to the provided graphics context.
    void
    Sets alignments for multiple columns at once.
    void
    setColumns(String... columns)
    Replaces all existing columns with new column headers from strings.
    void
    setColumns(TableElement... elements)
    Replaces all existing columns with new TableElement column headers.
    void
    setRows(String[]... elements)
    Replaces all existing rows with new rows from string arrays.
    void
    setRows(TableRow... elements)
    Replaces all existing rows with new TableRow objects.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.runelite.client.ui.overlay.components.LayoutableRenderableEntity

    getBounds, setPreferredLocation, setPreferredSize
  • Constructor Details

    • TableComponent

      public TableComponent()
  • Method Details

    • render

      public Dimension render(Graphics2D graphics)
      Renders the table to the provided graphics context.
      Specified by:
      render in interface net.runelite.client.ui.overlay.RenderableEntity
      Parameters:
      graphics - the graphics context to render to
      Returns:
      the dimensions of the rendered table
    • isEmpty

      public boolean isEmpty()
      Checks if the table has no data to display.
      Returns:
      true if the table has no columns or no rows
    • setColumnAlignments

      public void setColumnAlignments(TableAlignment... alignments)
      Sets alignments for multiple columns at once.
      Parameters:
      alignments - the alignments to apply, one per column
    • addRow

      public void addRow(String... cells)
      Adds a row with the specified cell contents as strings. Each string is converted to a TableElement.
      Parameters:
      cells - the cell contents for the row
    • addRows

      public void addRows(TableRow... rows)
      Adds multiple pre-built TableRow objects to the table.
      Parameters:
      rows - the rows to add
    • setRows

      public void setRows(String[]... elements)
      Replaces all existing rows with new rows from string arrays.
      Parameters:
      elements - the new rows, each array representing a row's cell contents
    • setRows

      public void setRows(TableRow... elements)
      Replaces all existing rows with new TableRow objects.
      Parameters:
      elements - the new rows
    • addColumns

      public void addColumns(TableElement... columns)
      Adds multiple column headers as TableElement objects.
      Parameters:
      columns - the column headers to add
    • setColumns

      public void setColumns(TableElement... elements)
      Replaces all existing columns with new TableElement column headers.
      Parameters:
      elements - the new column headers
    • setColumns

      public void setColumns(String... columns)
      Replaces all existing columns with new column headers from strings.
      Parameters:
      columns - the new column header texts