Class WScrollPanel


public class WScrollPanel extends WClippedPanel
Similar to the JScrollPane in Swing, this widget represents a scrollable widget.
Since:
2.0.0
  • Field Details

    • horizontalScrollBar

      protected WScrollBar horizontalScrollBar
      The horizontal scroll bar of this panel.
    • verticalScrollBar

      protected WScrollBar verticalScrollBar
      The vertical scroll bar of this panel.
  • Constructor Details

    • WScrollPanel

      public WScrollPanel(WWidget widget)
      Creates a vertically scrolling panel.
      Parameters:
      widget - the viewed widget
  • Method Details

    • isScrollingHorizontally

      public net.fabricmc.fabric.api.util.TriState isScrollingHorizontally()
      Returns whether this scroll panel has a horizontal scroll bar.
      Returns:
      true if there is a horizontal scroll bar, default if a scroll bar should be added if needed, and false otherwise
    • setScrollingHorizontally

      public WScrollPanel setScrollingHorizontally(net.fabricmc.fabric.api.util.TriState scrollingHorizontally)
    • isScrollingVertically

      public net.fabricmc.fabric.api.util.TriState isScrollingVertically()
      Returns whether this scroll panel has a vertical scroll bar.
      Returns:
      true if there is a vertical scroll bar, * default if a scroll bar should be added if needed, * and false otherwise
    • setScrollingVertically

      public WScrollPanel setScrollingVertically(net.fabricmc.fabric.api.util.TriState scrollingVertically)
    • paint

      @Environment(CLIENT) public void paint(net.minecraft.client.util.math.MatrixStack matrices, int x, int y, int mouseX, int mouseY)
      Description copied from class: WWidget
      Paints this widget.
      Overrides:
      paint in class WClippedPanel
      Parameters:
      matrices - the rendering matrix stack
      x - this widget's X coordinate on the screen
      y - this widget's Y coordinate on the screen
      mouseX - the X coordinate of the cursor
      mouseY - the X coordinate of the cursor
    • layout

      public void layout()
      Description copied from class: WPanel
      Uses this Panel's layout rules to reposition and resize components to fit nicely in the panel.
      Overrides:
      layout in class WPanel
    • onMouseScroll

      public InputResult onMouseScroll(int x, int y, double amount)
      Description copied from class: WWidget
      Notifies this widget that the mouse has been scrolled inside its bounds.
      Overrides:
      onMouseScroll in class WWidget
      Parameters:
      x - The X coordinate of the event, in widget-space (0 is the left edge of this widget)
      y - The Y coordinate of the event, in widget-space (0 is the top edge of this widget)
      amount - The scrolled amount. Positive values are up and negative values are down.
      Returns:
      InputResult.PROCESSED if the event is handled, InputResult.IGNORED otherwise.
    • validate

      public void validate(GuiDescription c)
      Description copied from class: WPanel
      Creates component peers and initializes animation data for this Widget and all its children. The host screen handler must clear any heavyweight peers from its records before this method is called.

      This method must be called on the root panel of any screen once the widgets have been initialized.

      Subclasses should call super.validate(c) to ensure that children are validated.

      Overrides:
      validate in class WPanel
      Parameters:
      c - the host GUI description