本文整理汇总了Java中org.lwjgl.input.Keyboard.KEY_RETURN属性的典型用法代码示例。如果您正苦于以下问题:Java Keyboard.KEY_RETURN属性的具体用法?Java Keyboard.KEY_RETURN怎么用?Java Keyboard.KEY_RETURN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.lwjgl.input.Keyboard
的用法示例。
在下文中一共展示了Keyboard.KEY_RETURN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyTyped
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
if (keyCode == 14 && !this.text.isEmpty())
{
this.text = this.text.substring(0, this.text.length() - 1);
}
if (ChatAllowedCharacters.isAllowedCharacter(typedChar) && this.fontRendererObj.getStringWidth(this.text + typedChar) <= 90)
{
this.text = this.text + typedChar;
}
if (keyCode == 1 || keyCode== Keyboard.KEY_RETURN)
{
this.actionPerformed(this.doneBtn);
}
}
示例2: onKeyPress
public void onKeyPress(int keyCode)
{
switch(keyCode)
{
case Keyboard.KEY_DOWN:
if(selected < features.size() - 1)
selected++;
else
selected = 0;
break;
case Keyboard.KEY_UP:
if(selected > 0)
selected--;
else
selected = features.size() - 1;
break;
case Keyboard.KEY_RETURN:
features.get(selected).doPrimaryAction();
break;
}
}
示例3: onKey
@EventTarget
public void onKey(EventKeyboard e) {
switch (e.getKey()) {
case Keyboard.KEY_UP:
this.up();
break;
case Keyboard.KEY_DOWN:
this.down();
break;
case Keyboard.KEY_RIGHT:
this.right(Keyboard.KEY_RIGHT);
break;
case Keyboard.KEY_LEFT:
this.left();
break;
case Keyboard.KEY_RETURN:
this.right(Keyboard.KEY_RETURN);
break;
}
}
示例4: 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);
}
}
示例5: keyTyped
@Override
protected void keyTyped(char key, int keyCode) throws IOException {
if ((keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_TAB) && rangeWidget.isFocused()) {
sendPacketToServer(rangeWidget.getValue());
} else {
super.keyTyped(key, keyCode);
}
}
示例6: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode() || keyCode == Keyboard.KEY_RETURN || keyCode == UHCCompass.instance.keyHandler.getKeyCode(KeyHandler.MOVECOMPASS))
{
this.mc.displayGuiScreen(null);
if (this.mc.currentScreen == null)
{
this.mc.setIngameFocus();
}
}
super.keyTyped(typedChar, keyCode);
}
示例7: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if(keyCode == Keyboard.KEY_TAB)
{ this.textInput.setMaxStringLength(60);
ArrayList<String> stringList = new ArrayList<>();
if(dictonaryList.isEmpty())
{
stringList.addAll(CommandBase.getListOfStringsMatchingLastWord(HarshenUtils.listOf(this.textInput.getText()), Block.REGISTRY.getKeys()));
for(String s : HarshenUtils.getAllOreDictionaryList())
for(ItemStack stack : OreDictionary.getOres(s))
if(Block.getBlockFromItem(stack.getItem()) != Blocks.AIR)
stringList.add(s);
dictonaryList = CommandBase.getListOfStringsMatchingLastWord(HarshenUtils.listOf(this.textInput.getText()), stringList);
}
if(!dictonaryList.isEmpty())
this.textInput.setText(dictonaryList.get(timeOver++%dictonaryList.size()));
}
else
{
timeOver = 0;
dictonaryList.clear();
}
if(keyCode == Keyboard.KEY_RETURN)
closeGui();
this.textInput.textboxKeyTyped(typedChar, keyCode);
super.keyTyped(typedChar, keyCode);
}
示例8: keyTyped
@Override
protected void keyTyped(char c, int i)
{
channelName.textboxKeyTyped(c, i);
if(channelName.isFocused())
{
if(i == Keyboard.KEY_TAB)
{
isPublicChannel = !isPublicChannel;
for(GuiButton btn : buttonList)
{
if(btn.id == ID_PUBLIC_CHANNEL)
{
btn.displayString = I18n.translateToLocal(isPublicChannel ? "gui.yes" : "gui.no");
break;
}
}
}
if (i == Keyboard.KEY_RETURN)
{
confirm();
}
}
if (i == 1)
{
if(channelName.isFocused())
{
channelName.setText("");
channelName.setFocused(false);
}
else
{
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
}
}
示例9: keyTyped
@Override
public void keyTyped(char c, int keyindex)
{
if(!focused)
return;
if(keyindex == Keyboard.KEY_LEFT)
cyclePrevItem();
if(keyindex == Keyboard.KEY_RIGHT)
cycleNextItem();
if(keyindex == Keyboard.KEY_RETURN && actionCommand != null)
sendAction(actionCommand);
}
示例10: keyTyped
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
if (keyCode == mc.gameSettings.keyBindInventory.getKeyCode() || keyCode == Keyboard.KEY_RETURN || keyCode == UHCCompass.instance.keyHandler.getKeyCode(KeyHandler.QUICKCOORDS))
{
try{
int x = Integer.parseInt(xCoord.getText());
int z = Integer.parseInt(zCoord.getText());
UHCCompass.TARGETX_PROPERTY.set(x);
UHCCompass.TARGETZ_PROPERTY.set(z);
}catch(Exception e){
mc.player.sendMessage(new TextComponentTranslation("uhccompass.invalidcoords"));
}
UHCCompass.syncConfig();
this.mc.displayGuiScreen(null);
if (this.mc.currentScreen == null)
{
this.mc.setIngameFocus();
}
} else if(keyCode == Keyboard.KEY_TAB || keyCode == Keyboard.KEY_SPACE){
xCoord.setFocused(!xCoord.isFocused());
zCoord.setFocused(!zCoord.isFocused());
}else if(Character.isDigit(typedChar) || typedChar == '-' || keyCode == Keyboard.KEY_BACK || keyCode == Keyboard.KEY_LEFT || keyCode == Keyboard.KEY_RIGHT){
xCoord.textboxKeyTyped(typedChar, keyCode);
zCoord.textboxKeyTyped(typedChar, keyCode);
}else if (keyCode == 201)
{
this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().getLineCount() - 1);
}
else if (keyCode == 209)
{
this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().getLineCount() + 1);
}
super.keyTyped(typedChar, keyCode);
}
示例11: 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);
}
}
示例12: keyTyped
public void keyTyped(char character, int keyCode) throws IOException {
this.username.textboxKeyTyped(character, keyCode);
this.password.textboxKeyTyped(character, keyCode);
if (keyCode == Keyboard.KEY_TAB) {
this.username.setFocused(!this.username.isFocused());
this.password.setFocused(!this.password.isFocused());
}
if (keyCode == Keyboard.KEY_RETURN) {
actionPerformed((GuiButton) this.buttonList.get(0));
}
}
示例13: keyTyped
@Override
public void keyTyped(char typedChar, int keyCode) {
super.keyTyped(typedChar, keyCode);
if (keyCode == Keyboard.KEY_RETURN) {
value.setValueFromString(this.getText());
setText(value.getValue().toString());
}
}
示例14: 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;
}
}
示例15: keyTyped
@Override
public void keyTyped(char c, int key) {
if (c >= '0' && c <= '9') {
if (!amount.contains(".") || amount.contains(".") && amount.substring(amount.lastIndexOf(".")).length() < 3) {
System.out.println("WHAT");
amount = amount.concat("" + c);
}
}
if (c == '.') {
if (!amount.isEmpty() && !amount.contains(".")) {
amount = amount.concat("" + c);
} else if (amount.isEmpty()) {
amount = amount.concat("0" + 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) <= 100000) {
// 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);
}
}