Package xyz.gmitch215.socketmc.screen.ui
Class CustomButton
java.lang.Object
xyz.gmitch215.socketmc.screen.ui.AbstractWidget
xyz.gmitch215.socketmc.screen.ui.AbstractTextWidget
xyz.gmitch215.socketmc.screen.ui.AbstractButton
xyz.gmitch215.socketmc.screen.ui.CustomButton
- All Implemented Interfaces:
Serializable
,LayoutElement
,Positionable
Represents a custom button, rendered through a
DrawingContext
.- See Also:
-
Field Summary
Fields inherited from class xyz.gmitch215.socketmc.screen.ui.AbstractButton
BIG_WIDTH, DEFAULT_HEIGHT, DEFAULT_SPACING, DEFAULT_WIDTH, SMALL_WIDTH
Fields inherited from class xyz.gmitch215.socketmc.screen.ui.AbstractWidget
DEFAULT_PADDING, height, tooltip, width, x, y
-
Constructor Summary
ConstructorDescriptionCustomButton
(int x, int y, int width, int height, @NotNull String messageJSON, @NotNull DrawingContext context, boolean renderDefault) Creates a newCustomButton
.CustomButton
(int x, int y, int width, int height, @NotNull Text message, @NotNull DrawingContext context) Creates a newCustomButton
.CustomButton
(int x, int y, int width, int height, @NotNull Text message, @NotNull DrawingContext context, boolean renderDefault) Creates a newCustomButton
.CustomButton
(int x, int y, @NotNull Text message, @NotNull DrawingContext context) Creates a newCustomButton
.CustomButton
(int x, int y, @NotNull Text message, @NotNull DrawingContext context, boolean renderDefault) Creates a newCustomButton
.CustomButton
(@NotNull ElementBounds bounds, @NotNull Text message, @NotNull DrawingContext context) Creates a newCustomButton
.CustomButton
(@NotNull ElementBounds bounds, @NotNull Text message, @NotNull DrawingContext context, boolean renderDefault) Creates a newCustomButton
. -
Method Summary
Modifier and TypeMethodDescriptionGets the drawing context of the button.boolean
Gets whether the default button setup should be rendered.void
setRenderDefault
(boolean renderDefault) Sets whether to render the default button.Methods inherited from class xyz.gmitch215.socketmc.screen.ui.AbstractTextWidget
equals, getMessageJSON, setMessage, setMessageJSON
Methods inherited from class xyz.gmitch215.socketmc.screen.ui.AbstractWidget
clearListeners, getHeight, getListeners, getTooltip, getWidth, getX, getY, hashCode, onClick, setHeight, setTooltip, setWidth, setX, setY, toString, visitWidgets
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface xyz.gmitch215.socketmc.screen.layout.LayoutElement
setPosition, setSize, setSize, setSize
Methods inherited from interface xyz.gmitch215.socketmc.screen.Positionable
inSamePosition
-
Constructor Details
-
CustomButton
public CustomButton(@NotNull @NotNull ElementBounds bounds, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
bounds
- the bounds of the buttonmessage
- the message of the buttoncontext
- the drawing context- Throws:
IllegalArgumentException
- if the text or drawing context is null
-
CustomButton
public CustomButton(int x, int y, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
x
- the x-coordinate of the buttony
- the y-coordinate of the buttonmessage
- the message of the buttoncontext
- the drawing context- Throws:
IllegalArgumentException
- if the text or drawing context is null
-
CustomButton
public CustomButton(int x, int y, int width, int height, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
x
- the x-coordinate of the buttony
- the y-coordinate of the buttonwidth
- the width of the buttonheight
- the height of the buttonmessage
- the message of the buttoncontext
- the drawing context- Throws:
IllegalArgumentException
- if the bounds are invalid, or if the text or drawing context is null
-
CustomButton
public CustomButton(@NotNull @NotNull ElementBounds bounds, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context, boolean renderDefault) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
bounds
- the bounds of the buttonmessage
- the message of the buttoncontext
- the drawing contextrenderDefault
- whether to render the default button- Throws:
IllegalArgumentException
- if the text or drawing context is null
-
CustomButton
public CustomButton(int x, int y, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context, boolean renderDefault) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
x
- the x-coordinate of the buttony
- the y-coordinate of the buttonmessage
- the message of the buttoncontext
- the drawing contextrenderDefault
- whether to render the default button- Throws:
IllegalArgumentException
- if the text or drawing context is null
-
CustomButton
public CustomButton(int x, int y, int width, int height, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context, boolean renderDefault) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
x
- the x-coordinate of the buttony
- the y-coordinate of the buttonwidth
- the width of the buttonheight
- the height of the buttonmessage
- the message of the buttoncontext
- the drawing contextrenderDefault
- whether to render the default button- Throws:
IllegalArgumentException
- if the bounds are invalid, or if the text or drawing context is null
-
CustomButton
public CustomButton(int x, int y, int width, int height, @NotNull @NotNull String messageJSON, @NotNull @NotNull DrawingContext context, boolean renderDefault) throws IllegalArgumentException Creates a newCustomButton
.- Parameters:
x
- the x-coordinate of the buttony
- the y-coordinate of the buttonwidth
- the width of the buttonheight
- the height of the buttonmessageJSON
- the message of the buttoncontext
- the drawing contextrenderDefault
- whether to render the default button- Throws:
IllegalArgumentException
- if the bounds are invalid, or if the text or drawing context is null
-
-
Method Details
-
getContext
Gets the drawing context of the button.- Returns:
- the drawing context
-
isRenderDefault
public boolean isRenderDefault()Gets whether the default button setup should be rendered.- Returns:
- Whether to render the default button
-
setRenderDefault
public void setRenderDefault(boolean renderDefault) Sets whether to render the default button.- Parameters:
renderDefault
- whether to render the default button
-