Java Code Examples for com.jme3.input.event.KeyInputEvent#getKeyChar()
The following examples show how to use
com.jme3.input.event.KeyInputEvent#getKeyChar() .
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: TextEntryComponent.java From Lemur with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onKeyEvent( KeyInputEvent evt ) { ModifiedKeyInputEvent mEvt = (ModifiedKeyInputEvent)evt; if( mEvt.isPressed() || mEvt.isRepeating() ) { KeyAction key = mEvt.toKeyAction(); //new KeyAction(code, (control?KeyAction.CONTROL_DOWN:0), (shift?KeyAction.SHIFT_DOWN:0) ); KeyActionListener handler = actionMap.get(key); if( handler != null ) { handler.keyAction(TextEntryComponent.this, key); evt.setConsumed(); return; } // Making sure that no matter what, certain // characters never make it directly to the // document if( evt.getKeyChar() >= 32 ) { model.insert(evt.getKeyChar()); evt.setConsumed(); //resetText(); ...should be automatic now } } }
Example 2
Source File: InputSystemJme.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void onKeyEventQueued(KeyInputEvent evt, NiftyInputConsumer nic) { int code = evt.getKeyCode(); if (code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT) { shiftDown = evt.isPressed(); } else if (code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL) { ctrlDown = evt.isPressed(); } KeyboardInputEvent keyEvt = new KeyboardInputEvent(code, evt.getKeyChar(), evt.isPressed(), shiftDown, ctrlDown); if (nic.processKeyboardEvent(keyEvt)){ evt.setConsumed(); } }
Example 3
Source File: TestBitmapFont.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void onKeyEvent(KeyInputEvent evt) { if (evt.isReleased()) return; if (evt.getKeyChar() == '\n' || evt.getKeyChar() == '\r') { txt3.setText(str.toString()); str.setLength(0); } else { str.append(evt.getKeyChar()); } }
Example 4
Source File: ModifiedKeyInputEvent.java From Lemur with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ModifiedKeyInputEvent( KeyInputEvent delegate, int modifiers ) { super(delegate.getKeyCode(), delegate.getKeyChar(), delegate.isPressed(), delegate.isRepeating()); this.delegate = delegate; this.modifiers = modifiers; }