当前位置: 首页>>代码示例>>Java>>正文


Java Keyboard.KEY_NUMPADENTER属性代码示例

本文整理汇总了Java中org.lwjgl.input.Keyboard.KEY_NUMPADENTER属性的典型用法代码示例。如果您正苦于以下问题:Java Keyboard.KEY_NUMPADENTER属性的具体用法?Java Keyboard.KEY_NUMPADENTER怎么用?Java Keyboard.KEY_NUMPADENTER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEY_NUMPADENTER属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyTyped

protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    this.usernameField.textboxKeyTyped(typedChar, keyCode);
    this.passwordField.textboxKeyTyped(typedChar, keyCode);
    if (this.okButton.enabled && (keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_NUMPADENTER))
    {
        this.actionPerformed(this.okButton);
    }
    else if (keyCode == Keyboard.KEY_TAB)
    {
        boolean isUsernameFieldFocused = this.usernameField.isFocused();
        boolean isPasswordFieldFocused = this.passwordField.isFocused();
        this.usernameField.setFocused(isPasswordFieldFocused);
        this.passwordField.setFocused(isUsernameFieldFocused);
    }
}
 
开发者ID:ustc-zzzz,项目名称:AuthlibLoginHelper,代码行数:16,代码来源:AuthlibLoginHelperGui.java

示例2: keyTyped

@Override
protected void keyTyped(char par1, int par2) throws IOException {
    if (par2 == Keyboard.KEY_ESCAPE) {
        NetworkHandler.sendToServer(new PacketAphorismTileUpdate(tile));
    } else if (par2 == Keyboard.KEY_LEFT || par2 == Keyboard.KEY_UP) {
        cursorY--;
        if (cursorY < 0) cursorY = textLines.length - 1;
    } else if (par2 == Keyboard.KEY_DOWN || par2 == Keyboard.KEY_NUMPADENTER) {
        cursorY++;
        if (cursorY >= textLines.length) cursorY = 0;
    } else if (par2 == Keyboard.KEY_RETURN) {
        cursorY++;
        textLines = ArrayUtils.add(textLines, cursorY, "");
    } else if (par2 == Keyboard.KEY_BACK) {
        if (textLines[cursorY].length() > 0) {
            textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
            if (textLines[cursorY].endsWith("\u00a7")) {
                textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
            }
        } else if (textLines.length > 1) {
            textLines = ArrayUtils.remove(textLines, cursorY);
            cursorY--;
            if (cursorY < 0) cursorY = 0;
        }
    } else if (par2 == Keyboard.KEY_DELETE) {
        if (GuiScreen.isShiftKeyDown()) {
            textLines = new String[1];
            textLines[0] = "";
            cursorY = 0;
        } else {
            if (textLines.length > 1) {
                textLines = ArrayUtils.remove(textLines, cursorY);
                if (cursorY > textLines.length - 1)
                    cursorY = textLines.length - 1;
            }
        }
    } else if (ChatAllowedCharacters.isAllowedCharacter(par1)) {
        if (GuiScreen.isAltKeyDown()) {
            if (par1 >= 'a' && par1 <= 'f' || par1 >= 'l' && par1 <= 'o' || par1 == 'r' || par1 >= '0' && par1 <= '9') {
                textLines[cursorY] = textLines[cursorY] + "\u00a7" + par1;
            }
        } else {
            textLines[cursorY] = textLines[cursorY] + par1;
        }
    }
    tile.setTextLines(textLines);
    super.keyTyped(par1, par2);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:48,代码来源:GuiAphorismTile.java


注:本文中的org.lwjgl.input.Keyboard.KEY_NUMPADENTER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。