Package xyz.gmitch215.socketmc.screen.ui
Class AbstractButton
java.lang.Object
xyz.gmitch215.socketmc.screen.ui.AbstractWidget
xyz.gmitch215.socketmc.screen.ui.AbstractTextWidget
xyz.gmitch215.socketmc.screen.ui.AbstractButton
- All Implemented Interfaces:
Serializable
,LayoutElement
,Positionable
- Direct Known Subclasses:
CheckboxButton
,CustomButton
,CycleButton
,ImageButton
,LockButton
,SendInstructionButton
,TextButton
Represents a Button on the screen.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default width of a big button.static final int
The default height of a button.static final int
The default width and height spacing between buttons.static final int
The default width of a button.static final int
The default width of a small button.Fields inherited from class xyz.gmitch215.socketmc.screen.ui.AbstractWidget
DEFAULT_PADDING, height, tooltip, width, x, y
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractButton
(int x, int y, int width, int height, @NotNull String messageJSON) Constructs a new button.protected
AbstractButton
(int x, int y, int width, int height, @NotNull Text message) Constructs a new button.protected
AbstractButton
(int x, int y, @NotNull Text message) Constructs a new button using the default dimesions.protected
AbstractButton
(@NotNull ElementBounds bounds, @NotNull Text message) Constructs a new button using the specified bounds. -
Method Summary
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
-
Field Details
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTHThe default width of a button.- See Also:
-
SMALL_WIDTH
public static final int SMALL_WIDTHThe default width of a small button.- See Also:
-
BIG_WIDTH
public static final int BIG_WIDTHThe default width of a big button.- See Also:
-
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHTThe default height of a button.- See Also:
-
DEFAULT_SPACING
public static final int DEFAULT_SPACINGThe default width and height spacing between buttons.- See Also:
-
-
Constructor Details
-
AbstractButton
protected AbstractButton(@NotNull @NotNull ElementBounds bounds, @NotNull @NotNull Text message) throws IllegalArgumentException Constructs a new button using the specified bounds.- Parameters:
bounds
- the boundsmessage
- the text message- Throws:
IllegalArgumentException
- if bounds or message is null
-
AbstractButton
protected AbstractButton(int x, int y, @NotNull @NotNull Text message) throws IllegalArgumentException Constructs a new button using the default dimesions.- Parameters:
x
- the x-coordinatey
- the y-coordinatemessage
- the text message- Throws:
IllegalArgumentException
- if coordinates are negative, or message is null
-
AbstractButton
protected AbstractButton(int x, int y, int width, int height, @NotNull @NotNull Text message) throws IllegalArgumentException Constructs a new button.- Parameters:
x
- the x-coordinatey
- the y-coordinatewidth
- the widthheight
- the heightmessage
- the text message- Throws:
IllegalArgumentException
- if coordinates or dimensions are negative, or message is null
-
AbstractButton
protected AbstractButton(int x, int y, int width, int height, @NotNull @NotNull String messageJSON) throws IllegalArgumentException Constructs a new button.- Parameters:
x
- the x-coordinatey
- the y-coordinatewidth
- the widthheight
- the heightmessageJSON
- the text message in JSON format- Throws:
IllegalArgumentException
- if coordinates or dimensions are negative, or message is null
-