Package xyz.gmitch215.socketmc.screen.ui
Class SendInstructionButton
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.SendInstructionButton
- All Implemented Interfaces:
Serializable
,LayoutElement
,Positionable
Represents a button that sends an instruction when clicked.
- 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
ConstructorDescriptionSendInstructionButton
(int x, int y, int width, int height, @NotNull String messageJSON, @NotNull Instruction instruction) Constructs a new button.SendInstructionButton
(int x, int y, int width, int height, @NotNull Text message, @NotNull Instruction instruction) Constructs a new button.SendInstructionButton
(int x, int y, @NotNull Text message, @NotNull Instruction instruction) Constructs a new button using the default dimensions. -
Method Summary
Modifier and TypeMethodDescriptionGets the instruction to send when this button is clicked.void
setInstruction
(@NotNull Instruction instruction) Sets the instruction to send when this button is clicked.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
-
SendInstructionButton
public SendInstructionButton(int x, int y, @NotNull @NotNull Text message, @NotNull @NotNull Instruction instruction) throws IllegalArgumentException Constructs a new button using the default dimensions.- Parameters:
x
- the x-coordinatey
- the y-coordinatemessage
- the text messageinstruction
- the instruction to send- Throws:
IllegalArgumentException
- if coordinates are negative, or message/instruction is null
-
SendInstructionButton
public SendInstructionButton(int x, int y, int width, int height, @NotNull @NotNull Text message, @NotNull @NotNull Instruction instruction) throws IllegalArgumentException Constructs a new button.- Parameters:
x
- the x-coordinatey
- the y-coordinatewidth
- the widthheight
- the heightmessage
- the text messageinstruction
- the instruction to send- Throws:
IllegalArgumentException
- if coordinates or dimensions are negative, or message/instruction is null
-
SendInstructionButton
public SendInstructionButton(int x, int y, int width, int height, @NotNull @NotNull String messageJSON, @NotNull @NotNull Instruction instruction) throws IllegalArgumentException Constructs a new button.- Parameters:
x
- the x-coordinatey
- the y-coordinatewidth
- the widthheight
- the heightmessageJSON
- the text message in JSON formatinstruction
- the instruction to send- Throws:
IllegalArgumentException
- if coordinates or dimensions are negative, or message/instruction is null
-
-
Method Details
-
getInstruction
Gets the instruction to send when this button is clicked.- Returns:
- Instruction
-
setInstruction
public void setInstruction(@NotNull @NotNull Instruction instruction) throws IllegalArgumentException Sets the instruction to send when this button is clicked.- Parameters:
instruction
- the instruction- Throws:
IllegalArgumentException
- if instruction is null
-