public class UIButton extends UIComponent<UIButton> implements IGuiText<UIButton>
| Modifier and Type | Class and Description |
|---|---|
static class |
UIButton.ClickEvent
Event fired when a
UIButton is clicked. |
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 boolean |
autoSize
Whether the size of this
UIButton is automatically calculated based on its contents. |
protected int |
bgColor
The background color of this
UIButton. |
protected MalisisFont |
font
The
MalisisFont to use for this UITooltip. |
protected FontRenderOptions |
fro
The
FontRenderOptions to use for this UITooltip. |
protected FontRenderOptions |
hoveredFro
The
FontRenderOptions to use for this UITooltip when hovered. |
protected GuiIconProvider |
iconPressedProvider |
protected UIImage |
image
Image used for this
UIButton. |
protected boolean |
isPressed
Whether this
UIButton is currently being pressed. |
protected int |
offsetX
Offset for the contents
|
protected int |
offsetY
Offset for the contents
|
protected java.lang.String |
text
Text used for this
UIButton. |
| 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. |
int |
getBgColor()
Gets the background color of this
UIButton. |
MalisisFont |
getFont()
Gets the
MalisisFont. |
FontRenderOptions |
getFontRenderOptions()
Gets the
FontRenderOptions. |
FontRenderOptions |
getHoveredFontRendererOptions()
Gets the
FontRenderOptions used for this UILabel when hovered. |
UIImage |
getImage()
|
int |
getOffsetX()
Gets the text offset of this
UIButton. |
int |
getOffsetY()
Gets the text offset of this
UIButton. |
java.lang.String |
getPropertyString()
Gets the property string.
|
java.lang.String |
getText()
Gets the text of this
UIButton. |
boolean |
isAutoSize()
Checks if is width is automatically calculated.
|
boolean |
onButtonPress(int x,
int y,
MouseButton button)
On button press.
|
boolean |
onButtonRelease(int x,
int y,
MouseButton button)
On button release.
|
boolean |
onClick(int x,
int y)
On click.
|
UIButton |
setAutoSize(boolean autoSize)
Sets whether the size of this
UIButton should be calculated automatically. |
UIButton |
setBgColor(int bgColor)
Sets the background color of this
UIButton. |
UIButton |
setFont(MalisisFont font)
Sets the
MalisisFont. |
UIButton |
setFontRenderOptions(FontRenderOptions fro)
Sets the
FontRenderOptions. |
UIButton |
setHoveredFontRendererOptions(FontRenderOptions hoveredFro)
Sets the
FontRenderOptions used for this UILabel when hovered. |
UIButton |
setImage(UIImage image)
|
UIButton |
setOffset(int x,
int y)
Sets the text offset of this
UIButton. |
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, attachData, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getComponentAt, getData, getGui, getHeight, getIconProvider, getName, getParent, getRawHeight, getRawWidth, getRenderer, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onDoubleClick, onDrag, onKeyTyped, onMouseMove, onRightClick, onScrollWheel, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, self, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterprotected MalisisFont font
MalisisFont to use for this UITooltip.protected FontRenderOptions fro
FontRenderOptions to use for this UITooltip.protected FontRenderOptions hoveredFro
FontRenderOptions to use for this UITooltip when hovered.protected java.lang.String text
protected UIImage image
protected boolean autoSize
UIButton is automatically calculated based on its contents.protected boolean isPressed
UIButton is currently being pressed.protected int bgColor
UIButton.protected int offsetX
protected int offsetY
protected GuiIconProvider iconPressedProvider
public 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 MalisisFont getFont()
IGuiTextMalisisFont.public UIButton setFont(MalisisFont font)
IGuiTextMalisisFont.public FontRenderOptions getFontRenderOptions()
IGuiTextFontRenderOptions.getFontRenderOptions in interface IGuiText<UIButton>public UIButton setFontRenderOptions(FontRenderOptions fro)
IGuiTextFontRenderOptions.setFontRenderOptions in interface IGuiText<UIButton>fro - the fropublic FontRenderOptions getHoveredFontRendererOptions()
FontRenderOptions used for this UILabel when hovered.public UIButton setHoveredFontRendererOptions(FontRenderOptions hoveredFro)
FontRenderOptions used for this UILabel when hovered.hoveredFro - the hoveredFro to setUIButtonpublic java.lang.String getText()
UIButton.UIButton.public UIButton setText(java.lang.String text)
UIButton.text - the textUIButtonpublic UIImage getImage()
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 boolean isAutoSize()
UIButton cannot be smaller that its contents.public UIButton setAutoSize(boolean autoSize)
UIButton should be calculated automatically.autoSize - the autoSize to setpublic int getBgColor()
UIButton.public UIButton setBgColor(int bgColor)
UIButton.bgColor - the bg colorpublic int getOffsetX()
UIButton.public int getOffsetY()
UIButton.public UIButton setOffset(int x, int y)
UIButton.x - the xy - the ypublic boolean onClick(int x,
int y)
UIComponentonClick in class UIComponent<UIButton>x - the xy - the ypublic boolean onButtonPress(int x,
int y,
MouseButton button)
UIComponentonButtonPress in class UIComponent<UIButton>x - the xy - the ybutton - the buttonpublic boolean onButtonRelease(int x,
int y,
MouseButton button)
UIComponentonButtonRelease in class UIComponent<UIButton>x - the xy - the ybutton - the buttonpublic 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 java.lang.String getPropertyString()
UIComponentgetPropertyString in class UIComponent<UIButton>