Class ScrollPanel
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.neoforged.neoforge.client.gui.widget.ScrollPanel
- All Implemented Interfaces:
ContainerEventHandler
,GuiEventListener
,Renderable
,TabOrderedElement
,NarratableEntry
,NarrationSupplier
- Direct Known Subclasses:
ModListScreen.InfoPanel
,ModMismatchDisconnectedScreen.MismatchInfoPanel
public abstract class ScrollPanel
extends AbstractContainerEventHandler
implements Renderable, NarratableEntry
Abstract scroll panel class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final int
private final int
private final int
private final int
protected final int
protected final int
protected boolean
private final Minecraft
protected final int
protected final int
protected final int
protected float
private boolean
protected final int
protected final int
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorsConstructorDescriptionScrollPanel
(Minecraft client, int width, int height, int top, int left) ScrollPanel
(Minecraft client, int width, int height, int top, int left, int border) ScrollPanel
(Minecraft client, int width, int height, int top, int left, int border, int barWidth) ScrollPanel
(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int barBgColor, int barColor, int barBorderColor) Base constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate void
List
<? extends GuiEventListener> children()
protected boolean
clickPanel
(double mouseX, double mouseY, int button) protected void
drawBackground
(GuiGraphics guiGraphics, Tesselator tess, float partialTick) Draws the background of the scroll panel.protected void
drawGradientRect
(GuiGraphics guiGraphics, int left, int top, int right, int bottom, int color1, int color2) protected abstract void
drawPanel
(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) Draw anything special on the screen.private int
protected abstract int
private int
protected int
boolean
isMouseOver
(double mouseX, double mouseY) Checks if the given mouse coordinates are over the GUI element.boolean
mouseClicked
(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double mouseX, double mouseY, int button, double deltaX, double deltaY) Called when the mouse is dragged within the GUI element.boolean
mouseReleased
(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.boolean
mouseScrolled
(double p_94686_, double p_94687_, double p_94688_, double p_294830_) void
render
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) Renders the graphical user interface (GUI) element.Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocused
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyPressed, keyReleased, nextFocusPath, setFocused
Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getRectangle, mouseMoved
Methods inherited from interface net.minecraft.client.gui.narration.NarratableEntry
isActive, narrationPriority
Methods inherited from interface net.minecraft.client.gui.narration.NarrationSupplier
updateNarration
Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
client
-
width
protected final int width -
height
protected final int height -
top
protected final int top -
bottom
protected final int bottom -
right
protected final int right -
left
protected final int left -
scrolling
private boolean scrolling -
scrollDistance
protected float scrollDistance -
captureMouse
protected boolean captureMouse -
border
protected final int border -
barWidth
private final int barWidth -
barLeft
private final int barLeft -
barBgColor
private final int barBgColor -
barColor
private final int barColor -
barBorderColor
private final int barBorderColor
-
-
Constructor Details
-
ScrollPanel
- Parameters:
client
- the minecraft instance this ScrollPanel should usewidth
- the widthheight
- the heighttop
- the offset from the top (y coord)left
- the offset from the left (x coord)
-
ScrollPanel
- Parameters:
client
- the minecraft instance this ScrollPanel should usewidth
- the widthheight
- the heighttop
- the offset from the top (y coord)left
- the offset from the left (x coord)border
- the size of the border
-
ScrollPanel
public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth) - Parameters:
client
- the minecraft instance this ScrollPanel should usewidth
- the widthheight
- the heighttop
- the offset from the top (y coord)left
- the offset from the left (x coord)border
- the size of the borderbarWidth
- the width of the scroll barbgColorFrom
- the start color for the background gradientbgColorTo
- the end color for the background gradient
-
ScrollPanel
public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int barBgColor, int barColor, int barBorderColor) Base constructor- Parameters:
client
- the minecraft instance this ScrollPanel should usewidth
- the widthheight
- the heighttop
- the offset from the top (y coord)left
- the offset from the left (x coord)border
- the size of the borderbarWidth
- the width of the scroll barbarBgColor
- the color for the scroll bar backgroundbarColor
- the color for the scroll bar handlebarBorderColor
- the border color for the scroll bar handlebgColorFrom
- the start color for the background gradientbgColorTo
- the end color for the background gradient
-
-
Method Details
-
getContentHeight
protected abstract int getContentHeight() -
drawBackground
Draws the background of the scroll panel. This runs AFTER Scissors are enabled. -
drawPanel
protected abstract void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) Draw anything special on the screen. Scissor (RenderSystem.enableScissor) is enabled for anything that is rendered outside the view box. Do not mess with Scissor unless you support this. -
clickPanel
protected boolean clickPanel(double mouseX, double mouseY, int button) -
getMaxScroll
private int getMaxScroll() -
applyScrollLimits
private void applyScrollLimits() -
mouseScrolled
public boolean mouseScrolled(double p_94686_, double p_94687_, double p_94688_, double p_294830_) - Specified by:
mouseScrolled
in interfaceContainerEventHandler
- Specified by:
mouseScrolled
in interfaceGuiEventListener
-
getScrollAmount
protected int getScrollAmount() -
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Description copied from interface:GuiEventListener
Checks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOver
in interfaceGuiEventListener
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.- Returns:
true
if the mouse is over the GUI element,false
otherwise.
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) Description copied from interface:ContainerEventHandler
Called when a mouse button is clicked within the GUI element.- Specified by:
mouseClicked
in interfaceContainerEventHandler
- Specified by:
mouseClicked
in interfaceGuiEventListener
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) Description copied from interface:ContainerEventHandler
Called when a mouse button is released within the GUI element.- Specified by:
mouseReleased
in interfaceContainerEventHandler
- Specified by:
mouseReleased
in interfaceGuiEventListener
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was released.- Returns:
true
if the event is consumed,false
otherwise.
-
getBarHeight
private int getBarHeight() -
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) Description copied from interface:ContainerEventHandler
Called when the mouse is dragged within the GUI element.- Specified by:
mouseDragged
in interfaceContainerEventHandler
- Specified by:
mouseDragged
in interfaceGuiEventListener
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that is being dragged.deltaX
- the X distance of the drag.deltaY
- the Y distance of the drag.- Returns:
true
if the event is consumed,false
otherwise.
-
render
Description copied from interface:Renderable
Renders the graphical user interface (GUI) element.- Specified by:
render
in interfaceRenderable
- Parameters:
guiGraphics
- the GuiGraphics object used for rendering.mouseX
- the x-coordinate of the mouse cursor.mouseY
- the y-coordinate of the mouse cursor.partialTick
- the partial tick time.
-
drawGradientRect
protected void drawGradientRect(GuiGraphics guiGraphics, int left, int top, int right, int bottom, int color1, int color2) -
children
- Specified by:
children
in interfaceContainerEventHandler
-