當前位置: 首頁>>代碼示例>>Java>>正文


Java GuiTextField.getText方法代碼示例

本文整理匯總了Java中net.minecraft.client.gui.GuiTextField.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java GuiTextField.getText方法的具體用法?Java GuiTextField.getText怎麽用?Java GuiTextField.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.gui.GuiTextField的用法示例。


在下文中一共展示了GuiTextField.getText方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onTick

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void onTick() {
	if (this.repairGuiTask==null||!(this.repairGuiTask instanceof GuiRepair))
		return;
	final EntryId entryId = CurrentMode.instance.getEntryId();
	if (!entryId.isNameable())
		return;
	try {
		final GuiTextField textField = guiRepairTextField.get(this.repairGuiTask);
		final ContainerRepair containerRepair = guiRepairContainer.get(this.repairGuiTask);
		if (textField!=null&&containerRepair!=null) {
			final String text = textField.getText();
			if (!StringUtils.isEmpty(text)&&!StringUtils.equals(this.repairGuiTextFieldCache, text)) {
				final String name = entryId.id();
				Sign.setRepairName(name, textField, containerRepair);
				this.repairGuiTextFieldCache = name;
			}
		}
		return;
	} catch (final Exception e) {
		Log.notice(I18n.format("signpic.chat.error.place"));
	}
	Log.notice(I18n.format("signpic.chat.error.place"));
}
 
開發者ID:Team-Fruit,項目名稱:SignPicture,代碼行數:25,代碼來源:AnvilHandler.java

示例2: setCoords

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
private void setCoords(GuiTextField field, int index) {
		
	if (field.getText() != null && !field.getText().trim().isEmpty()) {

		int coord;
		
		if (index == 0) {				
			coord = parseInt(tileEntity.getControlPanel().targetX, field.getText());				
			tileEntity.getControlPanel().targetX = coord;
		}
		
		else {				
			coord = parseInt(tileEntity.getControlPanel().targetZ, field.getText());								
			tileEntity.getControlPanel().targetZ = coord;
		}
		
		FissionWarfare.network.sendToServer(new ServerPacketHandler("set.coords%" + tileEntity.xCoord + "%" + tileEntity.yCoord + "%" + tileEntity.zCoord + "%" + index + "%" + coord));
	}
}
 
開發者ID:TeamMonumental,項目名稱:FissionWarfare,代碼行數:20,代碼來源:GuiControlPanel.java

示例3: action

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void action(GuiBase gui) {
    GuiMoarSign guiM = (GuiMoarSign) gui;
    String s = "moarsign";
    for (GuiTextField textField : guiM.guiTextFields) {
        s += "\u001D" + textField.getText();
    }

    if (GuiMoarSign.isShiftKeyDown()) {
        s += "\u001E";

        int[] sizes = guiM.rowSizes;
        int[] locations = guiM.rowLocations;
        boolean[] hidden = guiM.visibleRows;
        boolean[] shadows = guiM.shadowRows;

        for (int i = 0; i < 4; i++) {
            s += (i > 0 ? "\u001F" : "") + sizes[i] + ":" + locations[i] + ":" + (hidden[i] ? 1 : 0) + ":" + (shadows[i] ? 1 : 0);
        }
    }

    guiM.buttonErase.action(gui);
    GuiScreen.setClipboardString(s + "\u001Dmoarsign");
}
 
開發者ID:GoryMoon,項目名稱:MoarSigns,代碼行數:25,代碼來源:ButtonCutSign.java

示例4: action

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void action(GuiBase gui) {
    GuiMoarSign guiM = (GuiMoarSign) gui;
    String s = "moarsign";
    for (GuiTextField textField : guiM.guiTextFields) {
        s += "\u001D" + textField.getText();
    }

    if (GuiMoarSign.isShiftKeyDown()) {
        s += "\u001E";

        int[] sizes = guiM.rowSizes;
        int[] locations = guiM.rowLocations;
        boolean[] hidden = guiM.visibleRows;
        boolean[] shadows = guiM.shadowRows;

        for (int i = 0; i < 4; i++) {
            s += (i > 0 ? "\u001F" : "") + sizes[i] + ":" + locations[i] + ":" + (hidden[i] ? 1 : 0) + ":" + (shadows[i] ? 1 : 0);
        }
    }

    GuiScreen.setClipboardString(s + "\u001Dmoarsign");
}
 
開發者ID:GoryMoon,項目名稱:MoarSigns,代碼行數:24,代碼來源:ButtonCopySign.java

示例5: makeField

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
GuiTextField makeField(int x, int y, int width, GuiTextField orig, int text_length) {
    String text = orig == null ? "" : orig.getText();
    int cornerX = (this.width - this.xSize) / 2;
    int cornerY = (this.height - this.ySize) / 2;
    GuiTextField ret = new GuiTextField(1337, this.fontRendererObj, cornerX + x, cornerY + y, width, 12);
    ret.setTextColor(-1);
    ret.setDisabledTextColour(-1);
    ret.setEnableBackgroundDrawing(true);
    ret.setMaxStringLength(text_length);
    ret.setText(text);
    return ret;
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:13,代碼來源:GuiArtifactForge.java

示例6: initGui

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void initGui() {
    this.buttonList.add(new PokegearExit(1, this.width / 2 - 40, height / 2 - 60, 30, 30, ""));
    streamTextBox = new GuiTextField(fontRendererObj, width / 2 - 100, height / 2 + 35, 200, 20);
    streamTextBox.setMaxStringLength(1000);
    streamTextBox.setText(" Insert URL Here");
    url = streamTextBox.getText();
}
 
開發者ID:AnDwHaT5,項目名稱:PixelUtilities,代碼行數:9,代碼來源:GuiHandHeldRadio.java

示例7: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(char typedChar, int key) {

    if (selectedTextField != -1) {
        int index = 0;
        for (GuiTextField textField : guiTextFields) {
            if (textField.isFocused())
                textField.textboxKeyTyped(typedChar, key);
            entitySign.signText[index++] = new TextComponentString(textField.getText());
        }
    }

    update();

    if (selectedTextField != -1) {
        if (key == 200) {
            guiTextFields[selectedTextField].setFocused(false);
            selectedTextField = selectedTextField - 1 < 0 ? 3 : selectedTextField - 1;
            guiTextFields[selectedTextField].setFocused(true);
        }

        if (key == 208 || key == 28 || key == 156) {
            guiTextFields[selectedTextField].setFocused(false);
            selectedTextField = selectedTextField + 1 > 3 ? 0 : selectedTextField + 1;
            guiTextFields[selectedTextField].setFocused(true);
        }
    }

    if (key == 1) {
        this.entitySign.markDirty();
        mc.thePlayer.closeScreen();
    }
}
 
開發者ID:GoryMoon,項目名稱:MoarSigns,代碼行數:34,代碼來源:GuiMoarSign.java

示例8: correctIfInvalid

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
private boolean correctIfInvalid(GuiTextField guiTextField, String retainable, char keyChar, int keyID) {
    if (guiTextField.textboxKeyTyped(keyChar, keyID)) {
        String originalString = guiTextField.getText();
        String numericString = CharMatcher.anyOf(retainable).retainFrom(guiTextField.getText())
                .replaceAll("^0*", "");
        if (!originalString.equals(numericString)) {
            guiTextField.setText(numericString);
        }
        if (guiTextField.getText().length() == 0) {
            guiTextField.setText("0");
        }
        return true;
    }
    return false;
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:16,代碼來源:SpawnerFields.java

示例9: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(char par1, int par2)
{
    if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
        this.mc.thePlayer.closeScreen();
    }
    if ((par1 < 48 || par1 > 57) && par1 != 8 && par1 != 0)
        return;

    GuiTextField textField = null;
    if (item1txt.isFocused())
    {
        textField = item1txt;
    }
    if (item2txt.isFocused())
    {
        textField = item2txt;
    }
    if (item3txt.isFocused())
    {
        textField = item3txt;
    }
    if(item4txt.isFocused())
    {
        textField = item4txt;
    }

    int cost = 0;
    if(textField.getText().length() > 0)
    {
        cost = Integer.parseInt(textField.getText());
    }

    if(cost > 999)
    {
        cost = 999;
        textField.setText(Integer.toString(cost));
    }
    else
    {
        textField.textboxKeyTyped(par1, par2);
        if(textField.getText() == "")
            textField.setText("0");
        String txt = textField.getText();
        if(txt.length() > 1)
        {
            if(txt.startsWith("0"))
            {
                textField.setText(txt.substring(1));
            }
        }
    }
    if(item1txt.getText().length() > 0)
        teRegister.slot1cost = Integer.parseInt(item1txt.getText());
    if(item2txt.getText().length() > 0)
        teRegister.slot2cost = Integer.parseInt(item2txt.getText());
    if(item3txt.getText().length() > 0)
        teRegister.slot3cost = Integer.parseInt(item3txt.getText());
    if(item4txt.getText().length() > 0)
        teRegister.slot4cost = Integer.parseInt(item4txt.getText());
    sendServerPacket();
}
 
開發者ID:shinaka,項目名稱:Carthage,代碼行數:63,代碼來源:GuiRegister.java


注:本文中的net.minecraft.client.gui.GuiTextField.getText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。