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


Java Keyboard.KEY_END屬性代碼示例

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


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

示例1: keyTyped

@Override
public void keyTyped(char eventChar, int eventKey)
{
    if (enabled() || eventKey == Keyboard.KEY_LEFT || eventKey == Keyboard.KEY_RIGHT || eventKey == Keyboard.KEY_HOME || eventKey == Keyboard.KEY_END)
    {
        this.textFieldValue.textboxKeyTyped((enabled() ? eventChar : Keyboard.CHAR_NONE), eventKey);

        if (configElement.getValidationPattern() != null)
        {
            if (configElement.getValidationPattern().matcher(this.textFieldValue.getText().trim()).matches())
                isValidValue = true;
            else
                isValidValue = false;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:GuiConfigEntries.java

示例2: keyTyped

@Override
public void keyTyped(char eventChar, int eventKey)
{
    if (owningScreen.enabled || eventKey == Keyboard.KEY_LEFT || eventKey == Keyboard.KEY_RIGHT
            || eventKey == Keyboard.KEY_HOME || eventKey == Keyboard.KEY_END)
    {
        this.textFieldValue.textboxKeyTyped((owningScreen.enabled ? eventChar : Keyboard.CHAR_NONE), eventKey);

        if (configElement.getValidationPattern() != null)
        {
            if (configElement.getValidationPattern().matcher(this.textFieldValue.getText().trim()).matches())
                isValidValue = true;
            else
                isValidValue = false;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:GuiEditArrayEntries.java

示例3: keyTyped

@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
    super.keyTyped(typedChar, keyCode);
    if (keyCode == Keyboard.KEY_BACK) {
        if (!text.isEmpty() && cursor > 0) {
            text = text.substring(0, cursor-1) + text.substring(cursor);
            cursor--;
        }
    } else if (keyCode == Keyboard.KEY_DELETE) {
        if (cursor < text.length()) {
            text = text.substring(0, cursor) + text.substring(cursor+1);
        }
    } else if (keyCode == Keyboard.KEY_HOME) {
        cursor = 0;
    } else if (keyCode == Keyboard.KEY_END) {
        cursor = text.length();
    } else if (keyCode == Keyboard.KEY_LEFT) {
        if (cursor > 0) {
            cursor--;
        }
    } else if (keyCode == Keyboard.KEY_RIGHT) {
        if (cursor < text.length()) {
            cursor++;
        }
    } else if (keyCode == Keyboard.KEY_ESCAPE) {
        close();
    } else if (keyCode == Keyboard.KEY_RETURN) {
        destination = new TeleportDestination(text, destination.getDimension(), destination.getPos(), destination.getSide());
        MeeCreepsMessages.INSTANCE.sendToServer(new PacketSetDestination(destination, destinationIndex));
        close();
    } else if (typedChar != 0) {
        if (text.length() < 15) {
            text = text.substring(0, cursor) + typedChar + text.substring(cursor);
            cursor++;
        }
    }
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:37,代碼來源:GuiAskName.java

示例4: keyTyped

@Override
public void keyTyped(char c, int key) {
    if (key == Keyboard.KEY_ESCAPE || key == Keyboard.KEY_RETURN) {
        setFocused(false);
    } else {
        String value = (String) getValue();
        if (key == Keyboard.KEY_BACK) {
            if (cursor == 0) return;
            --cursor;
            setValue(value.substring(0, cursor)
                    +value.substring(cursor+1,value.length()));
        } else if (key == Keyboard.KEY_DELETE) {
            if (cursor == value.length()) return;
            setValue(value.substring(0, cursor)
                    +value.substring(cursor+1,value.length()));
        } else if (key == Keyboard.KEY_HOME) {
            cursor = 0;
        } else if (key == Keyboard.KEY_END) {
            cursor = value.length();
        } else if (key == Keyboard.KEY_LEFT) {
            if (cursor > 0) --cursor;
        } else if (key == Keyboard.KEY_RIGHT) {
            if (cursor < value.length()) ++cursor;
        } else if (c != Keyboard.CHAR_NONE) {
            setValue(value.substring(0, cursor)+c
                    +value.substring(cursor,value.length()));
            ++cursor;
        }
        // TODO: selection, ^X, ^C, ^V
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:31,代碼來源:TextField.java

示例5: keyTyped

@Override
public void keyTyped(final char eventChar, final int eventKey) {
	if (enabled()||eventKey==Keyboard.KEY_LEFT||eventKey==Keyboard.KEY_RIGHT||eventKey==Keyboard.KEY_HOME||eventKey==Keyboard.KEY_END) {
		this.textFieldValue.textboxKeyTyped(enabled() ? eventChar : Keyboard.CHAR_NONE, eventKey);

		try {
			Charset.forName(this.textFieldValue.getText());
			this.isValidValue = true;
		} catch (final Exception e) {
			this.isValidValue = false;
		}
	}
}
 
開發者ID:Team-Fruit,項目名稱:McHeliPrivacyShield,代碼行數:13,代碼來源:Config.java


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