本文整理匯總了Java中net.minecraft.client.gui.GuiTextField.setCanLoseFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java GuiTextField.setCanLoseFocus方法的具體用法?Java GuiTextField.setCanLoseFocus怎麽用?Java GuiTextField.setCanLoseFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.gui.GuiTextField
的用法示例。
在下文中一共展示了GuiTextField.setCanLoseFocus方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui()
{
super.initGui();
int xPos = (width - xSize) / 2;
int yPos = (height - ySize) / 2;
textField = new GuiTextField(fontRendererObj, xPos + 25, yPos + 9, 128, 12);
textField.setFocused(true);
textField.setCanLoseFocus(false);
textField.setText(LayoutManager.searchField.text());
CategoryHandler.INSTANCE.updateProjectListFromText(textField.getText());
scrollBarXPos = xPos + SCROLLBAR_X_START_POS;
scrollBarYPos = yPos + SCROLLBAR_Y_START_POS;
}
示例2: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui() {
buttonList.add(new GuiButton(0, width - 105, height - 25, 100, 20, "Apply and continue"));
super.initGui();
namefield = new GuiTextField(1, fontRendererObj, 55, 110, 100, 10);
surnamefield = new GuiTextField(2, fontRendererObj, 55, 125, 100, 10);
namefield.setCanLoseFocus(true);
surnamefield.setCanLoseFocus(true);
genderGroup = new GuiRadioGroup(surnamefield.xPosition, surnamefield.yPosition + surnamefield.height + 5);
jobMenu = new GuiDropdownMenu(5, genderGroup.yPos + 20, surnamefield.getWidth() + 10, "Job: ");
genderGroup.buttonList.clear();
genderGroup.horizontal = true;
genderGroup.addButton(new GuiRadiobutton(0, 0, 0, 10, 10, "Male"));
genderGroup.addButton(new GuiRadiobutton(1, 0, 0, 10, 10, "Female"));
genderGroup.singleChoice = true;
jobMenu.setMaxHeight(4);
int enumid = 0;
for (EnumJob job : EnumUtils.getEnumList(EnumJob.class)) {
jobMenu.contents.add(new GuiMenuItem(jobMenu, enumid, job.name()));
enumid++;
}
}
示例3: 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");
}
示例4: 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");
}
示例5: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
public void initGui() {
buttonList.add(new GuiButton(0, (int) (width * 0.15), (int) (height * 0.6), 40, 20, "登陸"));
buttonList.add(new GuiButton(1, (int) (width * 0.35), (int) (height * 0.6), 40, 20, "注冊"));
buttonList.add(new GuiButton(2, (int) (width * 0.55), (int) (height * 0.6), 40, 20, "保存"));
buttonList.add(new GuiButton(3, (int) (width * 0.75), (int) (height * 0.6), 40, 20, "關閉"));
playerpassword = new GuiTextField(fontRendererObj, (int) (width * 0.5) - 150, (int) (height * 0.4), 300, 20);
playerpassword.setMaxStringLength(64); // 設置最大長度,可省略
playerpassword.setFocused(false); // 設置是否為焦點
playerpassword.setCanLoseFocus(true); // 設置為可以被取消焦點
}
示例6: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui(){
tfInput = new GuiTextField(fontRendererObj, (int)(width*0.5)-150, (int)(height*0.85), 300, 20);
tfInput.setMaxStringLength(10);
tfInput.setFocused(true);
tfInput.setCanLoseFocus(false);
}
示例7: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui() {
labelList.clear();
super.initGui();
this.guiLeft = (this.width - xSize) / 2;
this.guiTop = (this.height - ySize) / 2;
buttonNext = new GuiButtonNext(0, guiLeft + 130, guiTop + 51, 30, 20, I18n.format("tomsmod.gui.next"), I18n.format("tomsmod.gui.start"));
buttonList.add(buttonNext);
up1 = new GuiButtonNum(1, guiLeft + 20, guiTop + 26, 1, 1, 20);
up10 = new GuiButtonNum(1, guiLeft + 45, guiTop + 26, 10, 16, 25);
up100 = new GuiButtonNum(1, guiLeft + 75, guiTop + 26, 100, 32, 30);
up1000 = new GuiButtonNum(1, guiLeft + 110, guiTop + 26, 1000, 64, 35);
down1 = new GuiButtonNum(1, guiLeft + 20, guiTop + 76, -1, -1, 20);
down10 = new GuiButtonNum(1, guiLeft + 45, guiTop + 76, -10, -16, 25);
down100 = new GuiButtonNum(1, guiLeft + 75, guiTop + 76, -100, -32, 30);
down1000 = new GuiButtonNum(1, guiLeft + 110, guiTop + 76, -1000, -64, 35);
buttonList.add(down1);
buttonList.add(down10);
buttonList.add(down100);
buttonList.add(down1000);
buttonList.add(up1);
buttonList.add(up10);
buttonList.add(up100);
buttonList.add(up1000);
numberField = new GuiTextField(1, mc.fontRenderer, guiLeft + 61, guiTop + 57, 59, 10);
numberField.setTextColor(0xFFFFFF);
numberField.setEnableBackgroundDrawing(false);
numberField.setText("1");
numberField.setCanLoseFocus(false);
numberField.setFocused(true);
numberField.setMaxStringLength(6);
TomsModUtils.addTextFieldToLabelList(numberField, labelList);
buttonBack = new GuiButtonHidden(2, guiLeft + 155, guiTop + 2, 18, 18);
buttonList.add(buttonBack);
}
示例8: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui() {
this.render = this.itemRender;
this.blockList = new GuiBlocksList( this, this.blocks );
search = new GuiTextField(150, getFontRender(), width / 2 - 100, height / 2 + 85, 140, 18);
search.setFocused(true);
search.setCanLoseFocus(true);
this.buttonList.add( new GuiButton( 0, width / 2 +43, height / 2 + 84, 60, 20, I18n.format("xray.single.cancel")) );
}
示例9: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui() {
super.initGui();
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
//Create and setup the textboxes
xbox = new GuiTextField(this.fontRendererObj, x + 113, y + 31, 50, 10);
ybox = new GuiTextField(this.fontRendererObj, x + 113, y + 41, 50, 10);
xbox.setMaxStringLength(15);
xbox.setEnableBackgroundDrawing(true);
xbox.setFocused(true);
xbox.setCanLoseFocus(true);
xbox.setEnabled(true);
ybox.setMaxStringLength(15);
ybox.setEnableBackgroundDrawing(true);
ybox.setFocused(false);
ybox.setCanLoseFocus(true);
ybox.setEnabled(true);
modeDown = new GuiImageButton(0, x + 103, y + 20, 5, 8, zmaster587.libVulpes.inventory.TextureResources.buttonLeft);
modeUp = new GuiImageButton(1, x + 157, y + 20, 5, 8, zmaster587.libVulpes.inventory.TextureResources.buttonRight);
this.buttonList.add(modeUp);
this.buttonList.add(modeDown);
this.buttonList.add(new GuiButton(2, x + 103, y + 62, 34,20, "Reset"));
}
示例10: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui() {
super.initGui();
buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false));
buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true));
searchField = new GuiTextField(15, fontRendererObj, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
searchField.setCanLoseFocus(false);
searchField.setFocused(true);
searchField.setEnableBackgroundDrawing(false);
updateAll();
}
示例11: 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)));
}
示例12: 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);
}
示例13: initGui
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question.
*/
public void initGui()
{
Keyboard.enableRepeatEvents(true);
this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
inputField = new GuiTextField(this.fontRendererObj, 4, this.height - 12, this.width - 4, 12);
inputField.setMaxStringLength(100);
inputField.setEnableBackgroundDrawing(false);
inputField.setFocused(true);
inputField.setText(this.defaultInputFieldText);
inputField.setCanLoseFocus(false);
//Initiate Symbol Buttons
GuiChatHandler.initButtons(buttonList);
}
示例14: init
import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void init(Minecraft mc, int x, int y, int lastButtonID, List<GuiButton> buttonList, List<GuiLabel> labelList) {
this.lastButtonID = lastButtonID;
this.buttonDown = new GuiButtonSelection(lastButtonID + 1, x + 17, y + 34);
this.buttonUp = new GuiButtonSelection(lastButtonID + 2, x + 17, y);
this.buttonNorth = new GuiButtonSelection(lastButtonID + 3, x + 17, y + 17);
this.buttonSouth = new GuiButtonSelection(lastButtonID + 4, x + 34, y + 34);
this.buttonWest = new GuiButtonSelection(lastButtonID + 5, x, y + 17);
this.buttonEast = new GuiButtonSelection(lastButtonID + 6, x + 34, y + 17);
buttonList.add(buttonDown);
buttonList.add(buttonEast);
buttonList.add(buttonNorth);
buttonList.add(buttonSouth);
buttonList.add(buttonUp);
buttonList.add(buttonWest);
int numId = lastButtonID + 7;
int guiLeft = x + 65, guiTop = y - 20;
up1 = new GuiButtonNum(numId, guiLeft + 20, guiTop + 26, 1, 1, 20);
up10 = new GuiButtonNum(numId, guiLeft + 45, guiTop + 26, 10, 16, 25);
up100 = new GuiButtonNum(numId, guiLeft + 75, guiTop + 26, 100, 32, 30);
up1000 = new GuiButtonNum(numId, guiLeft + 110, guiTop + 26, 1000, 64, 35);
down1 = new GuiButtonNum(numId, guiLeft + 20, guiTop + 76, -1, -1, 20);
down10 = new GuiButtonNum(numId, guiLeft + 45, guiTop + 76, -10, -16, 25);
down100 = new GuiButtonNum(numId, guiLeft + 75, guiTop + 76, -100, -32, 30);
down1000 = new GuiButtonNum(numId, guiLeft + 110, guiTop + 76, -1000, -64, 35);
buttonList.add(down1);
buttonList.add(down10);
buttonList.add(down100);
buttonList.add(down1000);
buttonList.add(up1);
buttonList.add(up10);
buttonList.add(up100);
buttonList.add(up1000);
numberField = new GuiTextField(1, mc.fontRenderer, guiLeft + 61, guiTop + 57, 59, 10);
numberField.setTextColor(0xFFFFFF);
numberField.setEnableBackgroundDrawing(true);
numberField.setText("1");
numberField.setCanLoseFocus(false);
numberField.setFocused(true);
numberField.setMaxStringLength(6);
TomsModUtils.addTextFieldToLabelList(numberField, labelList);
}
示例15: 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);
}