java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.gui.components.widgets.panel.Panel
All Implemented Interfaces:
net.minecraft.client.gui.components.Renderable
Direct Known Subclasses:
ScrollPanel, ViewportPanel

@Experimental public abstract class Panel extends Object implements net.minecraft.client.gui.components.Renderable
One layer of an AbstractMultiPanelWidget. Panels are stacked in the order they are added: the topmost visible panel gets input first, and a modal panel blocks input to (and dims) the panels below it.

A panel can own plain widgets (buttons, edit boxes...) through addChild(AbstractWidget); they are drawn after renderContents(net.minecraft.client.gui.GuiGraphics, int, int, float) and receive mouse input before the panel itself. Lay them out in onResized().

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final net.minecraft.client.gui.Font
     
    protected final net.minecraft.client.Minecraft
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <W extends net.minecraft.client.gui.components.AbstractWidget>
    W
    addChild(W widget)
     
    final void
    Called by the owning widget; a panel belongs to one widget.
    boolean
    charTyped(char codePoint, int modifiers)
     
    protected List<net.minecraft.client.gui.components.AbstractWidget>
     
    final net.minecraft.client.gui.navigation.ScreenRectangle
     
    final @Nullable AbstractMultiPanelWidget
     
    final boolean
     
    boolean
    isMouseOver(double mouseX, double mouseY)
     
    final boolean
     
    boolean
    keyPressed(int keyCode, int scanCode, int modifiers)
     
    boolean
    keyReleased(int keyCode, int scanCode, int modifiers)
     
    boolean
    mouseClicked(double mouseX, double mouseY, int button)
     
    boolean
    mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY)
     
    void
    mouseMoved(double mouseX, double mouseY)
     
    boolean
    mouseReleased(double mouseX, double mouseY, int button)
     
    boolean
    mouseScrolled(double mouseX, double mouseY, double delta)
     
    protected void
     
    protected void
    Lay out children here.
    protected void
     
    protected void
    removeChild(net.minecraft.client.gui.components.AbstractWidget widget)
     
    final void
    render(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick)
     
    protected abstract void
    renderContents(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick)
    Draws the panel's own contents; children are drawn on top afterwards.
    final void
    setBounds(net.minecraft.client.gui.navigation.ScreenRectangle bounds)
    Sets the panel's screen-space bounds; onResized() runs only when they change.
    final Panel
    setModal(boolean modal)
    A modal panel dims the panels below it and swallows input that would reach them.
    final void
    setVisible(boolean visible)
     

    Methods inherited from class java.lang.Object

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

    • minecraft

      protected final net.minecraft.client.Minecraft minecraft
    • font

      protected final net.minecraft.client.gui.Font font
  • Constructor Details

    • Panel

      public Panel()
  • Method Details

    • attach

      @Internal public final void attach(AbstractMultiPanelWidget owner)
      Called by the owning widget; a panel belongs to one widget.
    • getOwner

      @Nullable public final @Nullable AbstractMultiPanelWidget getOwner()
    • setBounds

      public final void setBounds(net.minecraft.client.gui.navigation.ScreenRectangle bounds)
      Sets the panel's screen-space bounds; onResized() runs only when they change.
    • getBounds

      public final net.minecraft.client.gui.navigation.ScreenRectangle getBounds()
    • onResized

      protected void onResized()
      Lay out children here.
    • onShown

      protected void onShown()
    • onHidden

      protected void onHidden()
    • isVisible

      public final boolean isVisible()
    • setVisible

      public final void setVisible(boolean visible)
    • isModal

      public final boolean isModal()
    • setModal

      public final Panel setModal(boolean modal)
      A modal panel dims the panels below it and swallows input that would reach them.
    • addChild

      protected <W extends net.minecraft.client.gui.components.AbstractWidget> W addChild(W widget)
    • removeChild

      protected void removeChild(net.minecraft.client.gui.components.AbstractWidget widget)
    • children

      protected List<net.minecraft.client.gui.components.AbstractWidget> children()
    • renderContents

      protected abstract void renderContents(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick)
      Draws the panel's own contents; children are drawn on top afterwards.
    • render

      public final void render(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTick)
      Specified by:
      render in interface net.minecraft.client.gui.components.Renderable
    • isMouseOver

      public boolean isMouseOver(double mouseX, double mouseY)
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int button)
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY)
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double delta)
    • mouseMoved

      public void mouseMoved(double mouseX, double mouseY)
    • keyPressed

      public boolean keyPressed(int keyCode, int scanCode, int modifiers)
    • keyReleased

      public boolean keyReleased(int keyCode, int scanCode, int modifiers)
    • charTyped

      public boolean charTyped(char codePoint, int modifiers)