当前位置: 首页>>代码示例>>Java>>正文


Java KeyInputEvent.getKeyChar方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:InputSystemJme.java

示例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
        }
    }
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:23,代码来源:TextEntryComponent.java

示例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());
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:TestBitmapFont.java

示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:6,代码来源:KeyboardUIEvent.java

示例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;                  
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:7,代码来源:ModifiedKeyInputEvent.java


注:本文中的com.jme3.input.event.KeyInputEvent.getKeyChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。