Package xyz.gmitch215.socketmc.screen.ui
Class CustomWidget
java.lang.Object
xyz.gmitch215.socketmc.screen.ui.AbstractWidget
xyz.gmitch215.socketmc.screen.ui.AbstractTextWidget
xyz.gmitch215.socketmc.screen.ui.CustomWidget
- All Implemented Interfaces:
Serializable
,LayoutElement
,Positionable
Represents a custom widget, rendered through a
DrawingContext
.- See Also:
-
Field Summary
Fields inherited from class xyz.gmitch215.socketmc.screen.ui.AbstractWidget
DEFAULT_PADDING, height, tooltip, width, x, y
-
Constructor Summary
ConstructorDescriptionCustomWidget
(int x, int y, int width, int height, @NotNull String messageJSON, @NotNull DrawingContext context) Creates a newCustomWidget
.CustomWidget
(int x, int y, int width, int height, @NotNull Text message, @NotNull DrawingContext context) Creates a newCustomWidget
.CustomWidget
(@NotNull ElementBounds bounds, @NotNull Text message, @NotNull DrawingContext context) Creates a newCustomWidget
. -
Method Summary
Modifier and TypeMethodDescriptionGets the drawing context of the widget.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
-
CustomWidget
public CustomWidget(@NotNull @NotNull ElementBounds bounds, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context) throws IllegalArgumentException Creates a newCustomWidget
.- Parameters:
bounds
- the boundsmessage
- the text messagecontext
- the drawing context- Throws:
IllegalArgumentException
- if bounds, message, or context is null
-
CustomWidget
public CustomWidget(int x, int y, int width, int height, @NotNull @NotNull Text message, @NotNull @NotNull DrawingContext context) throws IllegalArgumentException Creates a newCustomWidget
.- Parameters:
x
- the x-coordinatey
- the y-coordinatewidth
- the widthheight
- the heightmessage
- the text messagecontext
- the drawing context- Throws:
IllegalArgumentException
- if the bounds are invalid, or if the text or drawing context is null
-
CustomWidget
public CustomWidget(int x, int y, int width, int height, @NotNull @NotNull String messageJSON, @NotNull @NotNull DrawingContext context) throws IllegalArgumentException Creates a newCustomWidget
.- Parameters:
x
- the x-coordinatey
- the y-coordinatewidth
- the widthheight
- the heightmessageJSON
- the text message in JSON formatcontext
- the drawing context- 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 widget.- Returns:
- the drawing context
-