public class UIButton extends UIComponent<UIButton>
| Modifier and Type | Class and Description |
|---|---|
static class |
UIButton.ClickEvent |
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate| Modifier and Type | Field and Description |
|---|---|
protected GuiIcon |
iconDisabled |
protected GuiIcon |
iconHovered |
| Constructor and Description |
|---|
UIButton(MalisisGui gui)
Instantiates a new
UIButton. |
UIButton(MalisisGui gui,
java.lang.String text)
Instantiates a new
UIButton. |
UIButton(MalisisGui gui,
UIImage image)
Instantiates a new
UIButton. |
| Modifier and Type | Method and Description |
|---|---|
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called first when drawing this
UIComponent. |
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called last when drawing this
UIComponent. |
java.lang.String |
getPropertyString()
Gets the property string.
|
java.lang.String |
getText()
Gets the text of this
UIButton. |
void |
onClick(MouseEvent.ButtonStateEvent event) |
void |
setHovered(boolean hovered)
Sets the
hovered state of this UIComponent. |
UIButton |
setImage(UIImage image)
|
UIButton |
setSize(int width)
Sets the width of this
UIButton with a default height of 20px. |
UIButton |
setSize(int width,
int height)
Sets the size of this
UIButton. |
UIButton |
setText(java.lang.String text)
Sets the text of this
UIButton. |
addControlComponent, componentX, componentY, draw, fireEvent, fireKeyboardEvent, fireMouseEvent, getAlpha, getAnchor, getComponentAt, getGui, getHeight, getName, getParent, getRawHeight, getRawWidth, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, setAlpha, setAnchor, setDisabled, setFocused, setName, setParent, setPosition, setPosition, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterpublic UIButton(MalisisGui gui)
UIButton.gui - the guipublic UIButton(MalisisGui gui, java.lang.String text)
UIButton.gui - the guitext - the textpublic UIButton(MalisisGui gui, UIImage image)
UIButton.gui - the guiimage - the imagepublic UIButton setText(java.lang.String text)
UIButton. If a width of 0 was previously set, it will be recalculated for this text.text - the textUIButtonpublic java.lang.String getText()
UIButton.UIButton.public UIButton setImage(UIImage image)
UIImage for this UIButton. If a width of 0 was previously set, it will be recalculated for this image.image - the imageUIButtonpublic UIButton setSize(int width)
UIButton with a default height of 20px.width - the widthUIButtonpublic UIButton setSize(int width, int height)
UIButton.setSize in interface ITransformable.Size<UIButton>setSize in class UIComponent<UIButton>width - the widthheight - the heightUIButtonpublic void setHovered(boolean hovered)
UIComponenthovered state of this UIComponent.setHovered in class UIComponent<UIButton>hovered - the new statepublic void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawBackground in class UIComponent<UIButton>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawForeground in class UIComponent<UIButton>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void onClick(MouseEvent.ButtonStateEvent event)
public java.lang.String getPropertyString()
UIComponentgetPropertyString in class UIComponent<UIButton>