Class TPanelElement

All Implemented Interfaces:
INode<TElement>, INodeBounded<TElement,Bounds2i>, INodeRenderable<TElement, TGuiGraphics>, Iterable<TElement>, Collection<TElement>
Direct Known Subclasses:
TPanelElement.Paintable, TPanelElement.Transparent

@Environment(CLIENT) @Virtual public class TPanelElement extends TElement
A panel element primarily featuring functionality like scrolling.
  • Field Details

  • Constructor Details

    • TPanelElement

      public TPanelElement()
  • Method Details

    • scrollAmountProperty

      public NotNullProperty<Point2d> scrollAmountProperty()
      The NotNullProperty representing the two-dimensional scroll amount value, with each axis ranging 0 to 1.
    • scrollPaddingProperty

      public final IntegerProperty scrollPaddingProperty()
      The IntegerProperty holding the "padding" of this TPanelElement.
    • scrollSensitivityProperty

      public final IntegerProperty scrollSensitivityProperty()
      The IntegerProperty for this TPanelElement's sensitivity of scrolling done by keyboard and mouse input.
    • renderCallback

      @Virtual public void renderCallback(@NotNull @NotNull TGuiGraphics pencil)
      Description copied from interface: INodeRenderable
      Callback method that is invoked when this Node is being rendered.
      Specified by:
      renderCallback in interface INodeRenderable<TElement, TGuiGraphics>
      Overrides:
      renderCallback in class TElement
      Parameters:
      pencil - The rendering context.
    • postRenderCallback

      @Virtual public void postRenderCallback(@NotNull @NotNull TGuiGraphics pencil)
      Description copied from interface: INodeRenderable
      Callback method that is invoked after this Node and all of their children have been rendered.
      Specified by:
      postRenderCallback in interface INodeRenderable<TElement, TGuiGraphics>
      Overrides:
      postRenderCallback in class TElement
      Parameters:
      pencil - The rendering context.
    • inputCallback

      @Virtual public boolean inputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull @NotNull TInputContext context)
      Description copied from class: TElement
      A callback method that is invoked when the user makes an input.
      Overrides:
      inputCallback in class TElement
      Parameters:
      phase - The input discovery phase.
      context - Information about the user's input.
      Returns:
      true if this TElement handled the input.
    • scroll

      public final void scroll(int deltaX, int deltaY)
      Scrolls this TPanelElement by moving the children via TElement.moveChildren(int, int).
      Parameters:
      deltaX - The X scroll amount, in in-game on-screen units.
      deltaY - The Y scroll amount, in in-game on-screen units.
      API Note:
      Note that this method differs from TElement.moveChildren(int, int) in that it also affects the value of scrollAmountProperty().
    • computeNextYBounds

      @NotNull public final @NotNull Bounds2i computeNextYBounds(int height, int gap)
      Computes the bounds for the next element to be added vertically, given the specified height and gap.
      Parameters:
      height - The height of the next element.
      gap - The vertical gap between the last element and the next one.
      Returns:
      A Bounds2i representing the position and size of the next element.
    • computeNextXBounds

      @NotNull public final @NotNull Bounds2i computeNextXBounds(int width, int gap)
      Computes the bounds for the next element to be added horizontally, given the specified width and gap.
      Parameters:
      width - The width of the next element.
      gap - The horizontal gap between the last element and the next one.
      Returns:
      A Bounds2i representing the position and size of the next element.
    • addAllVertically

      public final void addAllVertically(@NotNull @NotNull Iterable<TElement> elements, int gap) throws NullPointerException
      Adds all specified elements vertically with the given gap between each element. Each added element is resized horizontally to fit the TPanelElement's viewport width.
      Parameters:
      elements - The elements to add.
      gap - The vertical gap between each element.
      Throws:
      NullPointerException - The argument is null.