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


Java Keyboard.KEY_ESCAPE屬性代碼示例

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


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

示例1: func_146282_l

@Override
public void func_146282_l() {
    if (Bit.getInstance() == null) {
        return;
    }
    int key = Keyboard.getEventKey();
    char cha = Keyboard.getEventCharacter();
    if (key == Keyboard.KEY_NONE) return;

    if (key == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) {
        Wrapper.displayGuiScreen(null);
        return;
    }

    if (key == Keyboard.KEY_F11) Wrapper.getMinecraft().func_71352_k();

    Iterator<Window> iter = Bit.getInstance().getClickGui().getWindows().iterator();
    while (iter.hasNext()) {
        Window comp = iter.next();
        if (Keyboard.getEventKeyState())
            comp.keyPress(key, cha);
        else
            comp.keyRelease(key, cha);
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:25,代碼來源:ClickGuiDisplayer.java

示例2: keyPress

@Override
public void keyPress(int key, char keyChar) {
    if (this.extended)
        this.componentList.keyPress(key, keyChar);

    if (this.binding) {
        if (key != Keyboard.KEY_NONE && key != Keyboard.KEY_ESCAPE && key != Keyboard.KEY_LSHIFT && key != Keyboard.KEY_GRAVE && key != Keyboard.KEY_RSHIFT) {
            this.mod.setKeybind(key);
            new Thread(() -> {
                if (this.title == null || mod == null) return;
                this.title = "Bound to " + Keyboard.getKeyName(key);
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
                if (this.title == null || mod == null) return;
                this.title = mod.getId();
            }).start();
            this.binding = false;
        }
    }
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:22,代碼來源:ModComponent.java

示例3: keyTyped

@Override
protected void keyTyped(char character, int key) {
	
	if (key == Keyboard.KEY_ESCAPE)
		mc.displayGuiScreen(null);
	if (key == Keyboard.KEY_RIGHT && this.next.visible) {
		this.pageIndex++;
		this.savedIndex = pageIndex;
		NBTUtils.setInt(book, "savedIndex", savedIndex);
		updateButtons();
	}
	if (key == Keyboard.KEY_LEFT && this.prev.visible) {
		this.pageIndex--;
		this.savedIndex = pageIndex;
		NBTUtils.setInt(book, "savedIndex", savedIndex);
		updateButtons();
	}
	if (key == Keyboard.KEY_UP && this.backbutton.visible) {
		this.pageIndex = 2;
		this.savedIndex = pageIndex;
		NBTUtils.setInt(book, "savedIndex", savedIndex);
		updateButtons();
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:24,代碼來源:GuiBookGuide.java

示例4: keyTyped

@Override
protected void keyTyped(char c, int key) throws IOException {
    if (Widget.getFocused() == null) {
        if (key == Keyboard.KEY_ESCAPE || !justOpened && key == menuKey && key != Keyboard.KEY_NONE) {
            super.keyTyped(c, Keyboard.KEY_ESCAPE);
        } else if (key == Keyboard.KEY_DELETE) {
            Widget widget = Widget.getHovered();
            if (isElement(widget)) {
                widget.setActivated(true);
                widget.setValue(null);
            }
        }
    } else {
        Widget.getFocused().keyTyped(c, key);
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:16,代碼來源:ConfigMenu.java

示例5: onKey

@Override
public void onKey(KeyEvent e){
	Gui openGui=guiHandler.getOpenGui();
	if(openGui==null){
		if(e.code==Keyboard.KEY_ESCAPE){
			if(e.action==KeyAction.RELEASE) guiHandler.openGui(new GuiPause());
		}
		return;
	}
	openGui.onKey(e);
}
 
開發者ID:LapisSea,項目名稱:OpenGL-Bullet-engine,代碼行數:11,代碼來源:Renderer.java

示例6: keyTyped

@Override
protected void keyTyped(char par1, int par2) throws IOException
{
	if(par2 == Keyboard.KEY_ESCAPE)
		controller.close();
	else
		super.keyTyped(par1, par2);
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:8,代碼來源:EntitySetupGui.java

示例7: keyTyped

@Override
protected void keyTyped(char par1, int par2) throws IOException
{
    controller.handleMinecraftKey(par2);
    if (par2 != Keyboard.KEY_ESCAPE)
        super.keyTyped(par1, par2);
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:7,代碼來源:TimelineGui.java

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

示例9: keyTyped

public void keyTyped(char typedChar, int keyCode) throws IOException {
    if (isActive) {
        switch (keyCode) {
            case Keyboard.KEY_ESCAPE:
                isActive = false;
                break;

            case Keyboard.KEY_RETURN:
                isActive = false;
                //setValue(input);
                MC.player.sendMessage(new TextComponentString(input.toString()));
                break;

            case Keyboard.KEY_BACK:
                if (selectedIndex > -1) {
                    input.deleteCharAt(selectedIndex);
                    selectedIndex--;
                }
                break;

            case Keyboard.KEY_LEFT:
                selectedIndex--;
                break;

            case Keyboard.KEY_RIGHT:
                selectedIndex++;
                break;

            default:
                if (isValidChar(typedChar)) {
                    selectedIndex++;
                    input.insert(selectedIndex, typedChar);
                }
        }
        selectedIndex = MathHelper.clamp(selectedIndex, -1, input.length()-1);
    }
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:37,代碼來源:GuiTextInput.java

示例10: processDialogKey

public void processDialogKey(int keyCode, char keyChar, boolean Event)
{
	if (Event == true && keyCode == Keyboard.KEY_ESCAPE)
		DialogOpen = false;

	switch (DialogID)
	{
		case dialogSwitchTeam:
			break;
		case dialogLeaveGame:
			if (Event == true)
			{
				if (keyCode == Keyboard.KEY_RETURN
						|| keyCode == Keyboard.KEY_Y)
				{
					System.err.println("Player has chosen to quit.");
					game.destroy();
					return;
				}
				else if (keyCode == Keyboard.KEY_N)
				{
					DialogOpen = false;
					return;
				}
			}
			break;
	}
}
 
開發者ID:TheRemote,項目名稱:Spark,代碼行數:28,代碼來源:Dialog.java

示例11: keyTyped

@Override
  public void keyTyped(char c, int key)
  {
if (c >= '0' && c <= '9')
{
	amount = amount.concat("" + c);
}
if (key == Keyboard.KEY_BACK && amount != null && !amount.isEmpty()) {
	amount = amount.substring(0, amount.length() - 1);
}
if (key == Keyboard.KEY_RETURN) {
	AccountCapability cap = player.getCapability(Currency.ACCOUNT_DATA, null);
	if (amount != null && !amount.isEmpty() && Float.parseFloat(amount) <= 25000) {
		if (!deposit.enabled) {
			cap.addClientAmount(Float.parseFloat(amount), true);
			CurrencyUtils.depositMoney(player, Float.parseFloat(amount));
		} else if (!withdraw.enabled && Float.parseFloat(amount) <= cap.getAmount()) {
			cap.subtractClientAmount(Float.parseFloat(amount), true);
			PacketDispatcher.sendToServer(new MessageSyncDrops(player, Float.parseFloat(amount)));
		}
	}
	this.mc.displayGuiScreen((GuiScreen)null);
}
if (key == Keyboard.KEY_E || key == Keyboard.KEY_ESCAPE) {
	this.mc.displayGuiScreen((GuiScreen)null);
}
if (key == Keyboard.KEY_UP || key == Keyboard.KEY_DOWN) {
	withdraw.enabled = !withdraw.enabled;
	deposit.enabled = !deposit.enabled;
}
  }
 
開發者ID:Zundrel,項目名稱:Never-Enough-Currency,代碼行數:31,代碼來源:GuiATM.java

示例12: keyTyped

/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
@Override
protected void keyTyped(char eventChar, int eventKey)
{
    if (eventKey == Keyboard.KEY_ESCAPE)
        this.mc.displayGuiScreen(parentScreen);
    else
        this.entryList.keyTyped(eventChar, eventKey);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:12,代碼來源:GuiConfig.java

示例13: keyTyped

@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
	if(keyCode == Keyboard.KEY_RETURN)
		actionPerformed(editButton.enabled ? editButton : addButton);
	else if(keyCode == Keyboard.KEY_ESCAPE)
		actionPerformed(backButton);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:8,代碼來源:KeybindManagerScreen.java

示例14: keyTyped

@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
	valueField.textboxKeyTyped(typedChar, keyCode);
	
	if(keyCode == Keyboard.KEY_RETURN)
		actionPerformed(doneButton);
	else if(keyCode == Keyboard.KEY_ESCAPE)
		mc.displayGuiScreen(prevScreen);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:10,代碼來源:EditSliderScreen.java

示例15: keyTyped

@Override
public void keyTyped(char c, int key) {
    if (!hasFocus()) return;
    if (key == Keyboard.KEY_ESCAPE) {
        setFocused(false);
    } else if (key != Keyboard.KEY_NONE) {
        setValue(new KeyBind(key));
        setFocused(false);
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:10,代碼來源:KeyBinder.java


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