本文整理汇总了Java中com.jme3.input.event.KeyInputEvent.getKeyChar方法的典型用法代码示例。如果您正苦于以下问题:Java KeyInputEvent.getKeyChar方法的具体用法?Java KeyInputEvent.getKeyChar怎么用?Java KeyInputEvent.getKeyChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.event.KeyInputEvent
的用法示例。
在下文中一共展示了KeyInputEvent.getKeyChar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyEventQueued
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
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();
}
}
示例2: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent( KeyInputEvent evt ) {
ModifiedKeyInputEvent mEvt = (ModifiedKeyInputEvent)evt;
if( mEvt.isPressed() ) {
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
}
}
}
示例3: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@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());
}
}
示例4: KeyboardUIEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
public KeyboardUIEvent(KeyInputEvent originator, int modifiers, BaseElement element) {
this(originator.getKeyCode(), originator.getKeyChar(), originator.isPressed(), originator.isRepeating(),
modifiers, element);
this.originator = originator;
}
示例5: ModifiedKeyInputEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
public ModifiedKeyInputEvent( KeyInputEvent delegate, int modifiers ) {
super(delegate.getKeyCode(), delegate.getKeyChar(),
delegate.isPressed(), delegate.isRepeating());
this.delegate = delegate;
this.modifiers = modifiers;
}