Java Code Examples for org.lwjgl.input.Keyboard#KEY_V

The following examples show how to use org.lwjgl.input.Keyboard#KEY_V . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiNBTTree.java    From NBTEdit with GNU General Public License v3.0 5 votes vote down vote up
public void keyTyped(char ch, int key) {
	if (focusedSlotIndex != -1){
		saves[focusedSlotIndex].keyTyped(ch, key);
	}
	else{
		if (key == Keyboard.KEY_C && GuiControls.isCtrlKeyDown())
			copy();
		if (key == Keyboard.KEY_V && GuiControls.isCtrlKeyDown() && canPaste())
			paste();
		if (key == Keyboard.KEY_X && GuiControls.isCtrlKeyDown())
			cut();
	}
}
 
Example 2
Source File: ClientProxy.java    From Sakura_mod with MIT License 4 votes vote down vote up
@Override
public void init(FMLInitializationEvent event) {
    super.init(event);
    ChangeMode = new KeyBinding("key.sakura.sheath_in", Keyboard.KEY_V, "key.categories.sakura");
    ClientRegistry.registerKeyBinding(ChangeMode); 
}
 
Example 3
Source File: ToggleSprintKeybind.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ToggleSprintKeybind() {
    super("Toggle Sprint", Keyboard.KEY_V);
}
 
Example 4
Source File: GuiNBTEdit.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void keyTyped(char par1, int key) {
    GuiEditSingleNBT window = this.guiTree.getWindow();
    if (window != null) {
        window.keyTyped(par1, key);
    } else {
        this.nbtString.textboxKeyTyped(par1, key);
        switch (key) {
            case 1:
                this.quitWithoutSaving();
                break;
            case 211:
                this.guiTree.deleteSelected();
                break;
            case 28:
                this.guiTree.editSelected();
                break;
            case 200:
                this.guiTree.arrowKeyPressed(true);
                break;
            case 208:
                this.guiTree.arrowKeyPressed(false);
                break;
            case Keyboard.KEY_C:
                if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
                    this.guiTree.copy();
                }
                break;
            case Keyboard.KEY_V:
                if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
                    if (this.guiTree.canPaste()) {
                        this.guiTree.paste();
                    }
                }
                break;
            case Keyboard.KEY_X:
                if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
                    this.guiTree.cut();
                }
                break;
        }
    }
}
 
Example 5
Source File: TextInputBox.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 4 votes vote down vote up
public void beginStep() {
		if (hasFocus) {
			List<KeyboardEvent> keys = Game.getKeys();
			for (KeyboardEvent ke : keys) {
				if (ke.state) {
					char c = ke.eventChar;
					if(ke.isControlDown())
						switch(ke.key){
							case Keyboard.KEY_C:
								Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(input.toString()), null);
								continue;
							case Keyboard.KEY_V:
								String clip = getClipboardContent();
								for(char ch : clip.toCharArray()) {
									if (isValidCharacter(ch) && FEResources.getBitmapFont("default_med").getStringWidth(input.toString() + ch) < 246) {
										input.insert(cursorPos, ch);
										cursorPos++;
									}
								}
								continue;
						}
					if (isValidCharacter(c) && FEResources.getBitmapFont("default_med").getStringWidth(input.toString() + c) < 246) {
						input.insert(cursorPos, c);
						cursorPos++;
					} else {
						if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_LEFT) && cursorPos > 0) {
							cursorPos--;
						} else if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_RIGHT)
								&& cursorPos < input.length()) {
							cursorPos++;
						} else if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_BACK) && cursorPos > 0) {
							input.deleteCharAt(cursorPos - 1);
							cursorPos--;
						} else if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_DELETE)
								&& cursorPos < input.length()) {
							input.deleteCharAt(cursorPos);
						}
					}
				}
			}
		}
}