All Implemented Interfaces:
TParentElement, ITooltipProvider, IEnableStateProvider, IEnableStateProviderSetter, ITextProvider, ITextProviderSetter
Direct Known Subclasses:
FileListItem, TCheckboxWidget, TitleBar.TitleBarSquareButton, TMenuPanelButton, TSelectWidget, TSliderWidget

public class TButtonWidget extends TClickableWidget implements ITextProviderSetter
  • Field Details

    • text

      @Nullable protected @Nullable net.minecraft.text.Text text
    • onClick

      @Nullable protected @Nullable Consumer<TButtonWidget> onClick
    • icon

      @Nullable protected @Nullable UITexture icon
    • iconColor

      protected final float[] iconColor
  • Constructor Details

    • TButtonWidget

      public TButtonWidget(int x, int y, int width, int height)
    • TButtonWidget

      public TButtonWidget(int x, int y, int width, int height, net.minecraft.text.Text text)
    • TButtonWidget

      public TButtonWidget(int x, int y, int width, int height, net.minecraft.text.Text text, Consumer<TButtonWidget> onClick)
  • Method Details

    • getText

      @Nullable public final @Nullable net.minecraft.text.Text getText()
      Specified by:
      getText in interface ITextProvider
    • setText

      public void setText(@Nullable @Nullable net.minecraft.text.Text text)
      Specified by:
      setText in interface ITextProviderSetter
    • getOnClick

      @Nullable public final @Nullable Consumer<TButtonWidget> getOnClick()
    • setOnClick

      public void setOnClick(@Nullable @Nullable Consumer<TButtonWidget> onClick)
    • getIcon

      @Nullable public final @Nullable UITexture getIcon()
    • setIcon

      public void setIcon(@Nullable @Nullable UITexture icon)
    • getIconColor

      public final float[] getIconColor()
    • setIconColor

      public final void setIconColor(float r, float g, float b)
    • setIconColor

      public void setIconColor(float r, float g, float b, float a)
    • onClick

      protected void onClick()
      Description copied from class: TClickableWidget
      Called when this TClickableWidget is clicked, either by a mouse or a keyboard input, or by TClickableWidget.click(boolean).
      Specified by:
      onClick in class TClickableWidget
    • render

      public void render(TDrawContext pencil)
      Description copied from interface: TParentElement
      Renders this GUI element on the screen.
      Specified by:
      render in interface TParentElement
      Specified by:
      render in class TElement
      Parameters:
      pencil - The TDrawContext.
    • renderBackground

      protected void renderBackground(TDrawContext pencil)