| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
border
Gui边框的宽度
|
protected int |
brColor
Gui边框的颜色
|
protected int |
buttonColor
按钮未聚焦时的颜色
|
protected int |
buttonHorveredColor
按钮聚焦时的颜色
|
java.lang.String |
displayString
按钮显示的文本
|
boolean |
enabled
按钮是否启用,如果为false则按钮不能被操作
|
protected GuiTexturePos2D |
hoveredTexturePos
按钮聚焦时的材质位置
|
int |
packedFGColour
FML
|
protected GuiTexturePos2D |
texturePos
按钮未聚焦时的材质位置
|
enableTexture, fontRenderer, frame, guiTextureLoader, height, hovered, id, maxHeight, maxWidth, mc, visible, width, x, y| 构造器和说明 |
|---|
Button(java.lang.String buttonId,
int x,
int y,
int widthIn,
int heightIn,
java.lang.String buttonText)
使用自定义大小的按钮
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
drawGUI(int mouseX,
int mouseY,
float partialTicks)
绘制当前GUI到桌面
|
protected int |
getHoverState()
获取鼠标聚焦状态
|
boolean |
isMouseOvered()
判断Button是否为聚焦状态
|
void |
setBorder(int width)
设置Gui边框宽度
|
void |
setBrColor(int brColor)
设置边框颜色
|
void |
setButtonColor(int buttonColor,
int buttonHorveredColor)
设置按钮未聚焦的颜色
|
void |
setDisplayString(java.lang.String displayString)
设置按钮上显示的文本
|
void |
setTexturePos(GuiTexturePos2D texturePos,
GuiTexturePos2D hoveredTexturePos)
设置未聚焦状态的按钮材质位置
|
drawCustomSizedTexture, getFrame, getGuiID, getHeight, getId, getWidth, getX, getY, isHovered, isVisible, KeyInput, mouseClicked, mouseDragged, mousePressed, mouseReleased, onGuiClosed, playPressSound, setEnableTexture, setFrame, setHeight, setHovered, setId, setResolution, setTexture, setVisible, setWidth, setX, setY, updateGUIpublic java.lang.String displayString
public boolean enabled
public int packedFGColour
protected int buttonColor
protected int buttonHorveredColor
protected GuiTexturePos2D texturePos
protected GuiTexturePos2D hoveredTexturePos
protected int border
protected int brColor
public Button(java.lang.String buttonId,
int x,
int y,
int widthIn,
int heightIn,
java.lang.String buttonText)
Gui的ID(可填写任意值,但不建议与其他Gui的值相同) - x - 按钮在屏幕上的横坐标Xy - 按钮在屏幕上的纵坐标YwidthIn - 按钮的宽度heightIn - 按钮的高度buttonText - 按钮上显示的文本public void drawGUI(int mouseX,
int mouseY,
float partialTicks)
protected int getHoverState()
public boolean isMouseOvered()
public void setTexturePos(GuiTexturePos2D texturePos, GuiTexturePos2D hoveredTexturePos)
texturePos - 按钮未聚焦材质的位置hoveredTexturePos - 按钮聚焦材质的位置public void setDisplayString(java.lang.String displayString)
displayString - 显示的文本public void setButtonColor(int buttonColor,
int buttonHorveredColor)
buttonColor - 未聚焦按钮的RGB颜色buttonHorveredColor - 聚焦的按钮RGB颜色public void setBorder(int width)
width - 宽度public void setBrColor(int brColor)
brColor - RGB颜色