本文整理汇总了Java中net.minecraft.client.gui.GuiTextField.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java GuiTextField.setVisible方法的具体用法?Java GuiTextField.setVisible怎么用?Java GuiTextField.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.GuiTextField
的用法示例。
在下文中一共展示了GuiTextField.setVisible方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGui
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui() {
this.buttonList.clear();
Keyboard.enableRepeatEvents(true);
int left = (width - xSize) / 2;
int top = (height - ySize) / 2;
buttonList.add(searchButton = new GuiButton(0, left + 179, top + 14, 43, 20, StringUtils.translate("gui.search")));
queryField = new GuiTextField(fontRendererObj, left + 38, top + 19, 150, fontRendererObj.FONT_HEIGHT + 5);
queryField.setVisible(true);
queryField.setMaxStringLength(100);
queryField.setEnableBackgroundDrawing(true);
queryField.setCanLoseFocus(true);
queryField.setFocused(false);
queryField.setEnableBackgroundDrawing(false);
scrollbar = new GuiScrollbar(mc, left + 217, top + 44, 114, 0, ySize + 1, 8, 15, "playblock:textures/gui/search_bg.png");
}
示例2: initGui
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui() {
this.buttonList.clear();
Keyboard.enableRepeatEvents(true);
int left = (width - xSize) / 2;
int top = (height - ySize) / 2;
buttonList.add(addButton = new GuiButton(0, left + 215, top + 14, 25, 20, StringUtils.translate("gui.add")));
buttonList.add(clearUriButton = new GuiButton(1, left + 195, top + 14, 17, 20, "X"));
buttonList.add(removeButton = new GuiButton(2, left + 4, top + 130, 42, 20, StringUtils.translate("gui.remove")));
buttonList.add(clearButton = new GuiButton(3, left + 4, top + 100, 42, 20, StringUtils.translate("gui.clear")));
removeButton.enabled = false;
uriField = new GuiTextField(fontRendererObj, left + 35, top + 17, 157, fontRendererObj.FONT_HEIGHT + 5);
uriField.setVisible(true);
uriField.setMaxStringLength(100);
uriField.setEnableBackgroundDrawing(true);
uriField.setCanLoseFocus(true);
uriField.setFocused(false);
scrollbar = new GuiScrollbar(mc, left + 199, top + 54, 99, 0, ySize + 1, 5, 32, "playblock:textures/gui/queue_bg.png");
}
示例3: initGui
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui() {
super.initGui();
buttonList.clear();
Keyboard.enableRepeatEvents(true);
searchField = new GuiTextField(-1, fontRenderer, guiLeft + 20, guiTop + 36, 89, fontRenderer.FONT_HEIGHT);
searchField.setMaxStringLength(15);
searchField.setEnableBackgroundDrawing(true);
searchField.setVisible(true);
searchField.setFocused(true);
searchField.setTextColor(16777215);
updateCreativeSearch();
}
示例4: initGui
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
/** runs once every time the GUI is opened
*
*/
@Override
public void initGui(){
super.initGui();
RunesOfWizardry.networkWrapper.sendToServer(new DustDyeRequestUpdatePacket(PARENT.getPos()));
Keyboard.enableRepeatEvents(true);
//posX, posY defines the top left pixel of the gui display
int posX = (this.width - textureX) /2;
int posY = (this.height - textureY) /2;
//GuiTextField(fontrenderer, x, y, sizeX, sizeY)
//GuiTextField(int id, FontRenderer font, int xPos, int yPos, int width, int height)
//id is useless apparently
//here, 0,0 is the top left of the texture...
textColor = new GuiTextField(0, this.fontRenderer, 105, 14, 45, 12);
textColor.setMaxStringLength(6);
textColor.setEnableBackgroundDrawing(false);
textColor.setVisible(true);
textColor.setTextColor(16777215);
/*if the color from the TE is empty/default, translate it to use it as the text
* Doing it here instead of in the TE allows the 'Color' text to be localized when the GUI is opened, not only when the TE is placed
*/
String color= PARENT.getColorString();
if(color==null || color.equals("Color") || color.equals("")){
color= I18n.format(References.Lang.COLOR);
}
textColor.setText(color);
updateColor();
textColor.setFocused(true);
textColor.setCanLoseFocus(true);
//id, x, y, width, height, text
//note: height seems to need to be 20 to display full button texture
buttonList.add(new GuiButton(GUI_DYE_BUTTON,posX+99,posY+55,50,20,I18n.format(References.Lang.DYE)));
}
示例5: initGui
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
super.initGui();
Keyboard.enableRepeatEvents(true);
int btnx = guiLeft - 100;
int btny = guiTop + 20;
buttonList.clear();
btnRename = new GuiButton(4, btnx, btny, 100, 20, StatCollector.translateToLocal("gui.shipstatus.rename"));
buttonList.add(btnRename);
btnAssemble = new GuiButton(1, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.compile"));
buttonList.add(btnAssemble);
btnUndo = new GuiButton(2, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.undo"));
btnUndo.enabled = tileEntity.getPrevAssembleResult() != null && tileEntity.getPrevAssembleResult().getCode() != AssembleResult.RESULT_NONE;
buttonList.add(btnUndo);
btnMount = new GuiButton(3, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.mount"));
btnMount.enabled = tileEntity.getAssembleResult() != null && tileEntity.getAssembleResult().getCode() == AssembleResult.RESULT_OK;
buttonList.add(btnMount);
txtShipName = new GuiTextField(fontRendererObj, guiLeft + 8 + xSize / 2, guiTop + 21, 120, 10);
txtShipName.setMaxStringLength(127);
txtShipName.setEnableBackgroundDrawing(false);
txtShipName.setVisible(true);
txtShipName.setCanLoseFocus(false);
txtShipName.setTextColor(0xFFFFFF);
txtShipName.setText(tileEntity.getShipInfo().shipName);
}
示例6: initTextField
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
/**
* Prepare a text field for entry.
*
* @param field
* the field
* @param length
* the maximum length of the string
* @param text
* the initial text
*/
private void initTextField(GuiTextField field, int length, String text) {
field.setVisible(true);
field.setMaxStringLength(length);
field.setEnableBackgroundDrawing(true);
field.setCanLoseFocus(true);
field.setFocused(false);
field.setText(text);
}