Interface ComponentRenderer<T extends Component>

Type Parameters:
T - Type of the component which this renderer is designed for
All Known Subinterfaces:
Border.BorderRenderer, Button.ButtonRenderer, InteractableRenderer<T>, TableRenderer<V>, TextBox.TextBoxRenderer
All Known Implementing Classes:
AbstractListBox.DefaultListBoxRenderer, Borders.AbstractBorderRenderer, Borders.DoubleLineRenderer, Borders.SingleLineRenderer, Button.BorderedButtonRenderer, Button.DefaultButtonRenderer, Button.FlatButtonRenderer, CheckBox.CheckBoxRenderer, CheckBox.DefaultCheckBoxRenderer, ComboBox.ComboBoxRenderer, ComboBox.DefaultComboBoxRenderer, DefaultTableRenderer, MenuBar.DefaultMenuBarRenderer, MenuItem.DefaultMenuItemRenderer, MenuItem.MenuItemRenderer, Panel.DefaultPanelRenderer, ProgressBar.DefaultProgressBarRenderer, ProgressBar.LargeProgressBarRenderer, ScrollBar.DefaultScrollBarRenderer, ScrollBar.ScrollBarRenderer, Separator.DefaultSeparatorRenderer, Separator.SeparatorRenderer, TextBox.DefaultTextBoxRenderer

public interface ComponentRenderer<T extends Component>
This interface defines a renderer for a component, an external class that does the sizing and rendering. All components will have a default renderer defined, which can usually be overridden manually and swapped out for a different renderer, but also themes can contain renderer definitions which are automatically assigned to their associated components.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    drawComponent(TextGUIGraphics graphics, T component)
    Using the supplied graphics object, draws the component passed in.
    getPreferredSize(T component)
    Given the supplied component, how large does this renderer want the component to be? Notice that this is the responsibility of the renderer and not the component itself, since the component has no idea what its visual representation looks like.
  • Method Details

    • getPreferredSize

      TerminalSize getPreferredSize(T component)
      Given the supplied component, how large does this renderer want the component to be? Notice that this is the responsibility of the renderer and not the component itself, since the component has no idea what its visual representation looks like.
      Parameters:
      component - Component to calculate the preferred size of
      Returns:
      The size this renderer would like the component to take up
    • drawComponent

      void drawComponent(TextGUIGraphics graphics, T component)
      Using the supplied graphics object, draws the component passed in.
      Parameters:
      graphics - Graphics object to use for drawing
      component - Component to draw