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


Java GuiTextField.textboxKeyTyped方法代碼示例

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


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

示例1: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
 
	boolean textFocused = false;
	
	for (Gui control : this.controls) {
		if (control instanceof GuiTextField) {
			GuiTextField textField = (GuiTextField) control;
			if (textField.isFocused()) {
				textFocused = true;
				textField.textboxKeyTyped(typedChar, keyCode);
				break;
			}
		}
	}

	if (!textFocused || keyCode != Keyboard.KEY_E)
		super.keyTyped(typedChar, keyCode);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:20,代碼來源:GuiContainerBase.java

示例2: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(char eventChar, int eventKey) {
	super.keyTyped(eventChar, eventKey);
	boolean cont = false;
	for (GuiTextField text : textFields.values()) {
		text.textboxKeyTyped(eventChar, eventKey);
		cont = !text.isFocused() || cont;
	}
	if (Config.listenOnMacroScreen)
		if (cont)
			if (Keyboard.getEventKeyState()) {
				String currentText = textFields.get("macros").getText();
				currentText = (currentText != null && currentText.length() >= 1 ? currentText+"," : "")+Keyboard.getKeyName(Keyboard.getEventKey());
				textFields.get("macros").setText(eliminateRepeats(currentText));
			}
}
 
開發者ID:austinv11,項目名稱:MacroMaker,代碼行數:17,代碼來源:GuiMacro.java

示例3: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(final char character, final int code) throws IOException {
    if (code == Keyboard.KEY_ESCAPE) {
        this.mc.displayGuiScreen(this.parentScreen);
        return;
    }

    for (final GuiButton button : this.buttonList) {
        if (button instanceof GuiNumericField) {
            final GuiNumericField numericField = (GuiNumericField) button;
            numericField.keyTyped(character, code);

            if (numericField.isFocused()) {
                actionPerformed(numericField);
            }
        }
    }

    for (final GuiTextField textField : this.textFields) {
        textField.textboxKeyTyped(character, code);
    }

    super.keyTyped(character, code);
}
 
開發者ID:Lunatrius,項目名稱:LunatriusCore,代碼行數:25,代碼來源:GuiScreenBase.java

示例4: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
protected void keyTyped(char par1, int par2)
{
    for(GuiTextField field : secondPartFields)
    {
        if(field.isFocused())
            field.textboxKeyTyped(par1, par2);
    }
}
 
開發者ID:jglrxavpok,項目名稱:CustomAI,代碼行數:9,代碼來源:GuiCustomAI.java

示例5: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(char eventChar, int eventKey) {
	super.keyTyped(eventChar, eventKey);
	for (GuiTextField text : textFields.values())
		if (text.textboxKeyTyped(eventChar, eventKey))
			PeripheralsPlusPlus.NETWORK.sendToServer(new TextFieldInputEventPacket(UUID.fromString(Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getTagCompound().getString("identifier")), eventChar+"", text.getText(), "textboxEntry", Minecraft.getMinecraft().thePlayer.getDisplayName()));
	PeripheralsPlusPlus.NETWORK.sendToServer(new InputEventPacket(UUID.fromString(Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getTagCompound().getString("identifier")), Keyboard.getEventKey(), Keyboard.getEventKeyState(), "keyInput", Minecraft.getMinecraft().thePlayer.getDisplayName()));
}
 
開發者ID:austinv11,項目名稱:PeripheralsPlusPlus,代碼行數:9,代碼來源:GuiHelmet.java

示例6: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
public void keyTyped(char character, int keyId) {
	for (GuiTextField field : this.textfieldList) {
		field.textboxKeyTyped(character, keyId);
	}

	if (keyId == Keyboard.KEY_ESCAPE) {
		this.mc.thePlayer.closeScreen();
	}
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:11,代碼來源:GuiZertumInfo.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: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
private void keyTyped(GuiTextField field, char c, int code) {
	if (field instanceof GuiTextFieldCP && ((GuiTextFieldCP)field).isIdList) {
		if (c == ',' || (c >= '0' && c <= '9') || code == Keyboard.KEY_BACK) {
			field.textboxKeyTyped(c, code);
		}
	}
	else {
		field.textboxKeyTyped(c, code);
	}
}
 
開發者ID:uyjulian,項目名稱:ControlPack,代碼行數:11,代碼來源:GuiControlPackOptions.java

示例9: 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

示例10: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
@Override
protected void keyTyped(char eventChar, int eventKey) {
	super.keyTyped(eventChar, eventKey);
	for (GuiTextField text : textFields.values())
		text.textboxKeyTyped(eventChar, eventKey);
}
 
開發者ID:austinv11,項目名稱:MacroMaker,代碼行數:7,代碼來源:GuiWaypoint.java

示例11: 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

示例12: keyTyped

import net.minecraft.client.gui.GuiTextField; //導入方法依賴的package包/類
private void keyTyped(GuiTextField field, char c, int code) {
	if (c == ',' || c == '_' || c == '-' || c == ' ' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || code == Keyboard.KEY_BACK) {
		field.textboxKeyTyped(c, code);
	}
}
 
開發者ID:uyjulian,項目名稱:ControlPack,代碼行數:6,代碼來源:GuiWaypoints.java


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