com.jogamp.newt.event.KeyEvent.getKeyChar()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中com.jogamp.newt.event.KeyEvent.getKeyChar()方法的一些代码示例,展示了KeyEvent.getKeyChar()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.getKeyChar()方法的具体详情如下:
包路径:com.jogamp.newt.event.KeyEvent
类名称:KeyEvent
方法名:getKeyChar

KeyEvent.getKeyChar介绍

[英]Returns the UTF-16 character reflecting the #getKeySymbol()incl. active #isModifierKey().
[中]返回反映#getKeySymbol()包括active#isModifierKey()的UTF-16字符。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void keyReleased(KeyEvent evt) {
  int code = convertNewtKey(evt.getKeySymbol());
  KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, evt.isAutoRepeat());
  keyEvent.setTime(evt.getWhen());
  synchronized (eventQueue) {
    eventQueue.add(keyEvent);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void keyPressed(KeyEvent evt) {
  int code = convertNewtKey(evt.getKeySymbol());
  KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, evt.isAutoRepeat());
  keyEvent.setTime(evt.getWhen());
  synchronized (eventQueue){
    eventQueue.add(keyEvent);
  }
}

代码示例来源:origin: com.ardor3d/ardor3d-jogl

@Override
public synchronized void keyPressed(final com.jogamp.newt.event.KeyEvent e) {
  final Key pressed = fromKeyEventToKey(e);
  if (!_pressedList.contains(pressed)) {
    _upcomingEvents.add(new KeyEvent(pressed, KeyState.DOWN, e.getKeyChar()));
    _pressedList.add(pressed);
  }
  if (_consumeEvents) {
    e.setAttachment(NEWTEvent.consumedTag);
    // ignore this event
  }
}

代码示例来源:origin: com.ardor3d/ardor3d-jogl

@Override
public synchronized void keyReleased(final com.jogamp.newt.event.KeyEvent e) {
  final Key released = fromKeyEventToKey(e);
  _upcomingEvents.add(new KeyEvent(released, KeyState.UP, e.getKeyChar()));
  _pressedList.remove(released);
  if (_consumeEvents) {
    e.setAttachment(NEWTEvent.consumedTag);
    // ignore this event
  }
}

代码示例来源:origin: nifty-gui/nifty-gui

@Nonnull
private KeyboardInputEvent convert(@Nonnull final KeyEvent e, final boolean isKeyDown, final int keyCode) {
 return new KeyboardInputEvent(keyCode, e.getKeyChar(), isKeyDown, e.isShiftDown(), e.isControlDown());
}

代码示例来源:origin: jzy3d/jzy3d-api

@Override
public void keyReleased(KeyEvent e) {
  switch (e.getKeyChar()) {
  case 's':
    try {
      screenshot(chart, outputFile);
      fireDone(outputFile);
    } catch (IOException e1) {
      fireError(outputFile, e1);
    }
  default:
    break;
  }
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

if(e.getKeyChar()=='d') {
  new Thread() {
    public void run() {
      glWindow.setUndecorated(!glWindow.isUndecorated());
    } }.start();
} if(e.getKeyChar()=='f') {
  new Thread() {
    public void run() {
      glWindow.setFullscreen(!glWindow.isFullscreen());
    } }.start();
} else if(e.getKeyChar()=='a') {
  new Thread() {
    public void run() {
      glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop());
    } }.start();
} else if(e.getKeyChar()=='r' && null!=parentWin) {
  new Thread() {
    public void run() {
} else if(e.getKeyChar()=='c') {
  new Thread() {
    public void run() {
      System.err.println("[set pointer-icon post] "+currentPI+" -> "+glWindow.getPointerIcon());
    } }.start();
} else if(e.getKeyChar()=='i') {
  new Thread() {
    public void run() {

代码示例来源:origin: org.jmonkeyengine/jme3-jogl

public void keyPressed(KeyEvent evt) {
  int code = convertNewtKey(evt.getKeySymbol());
  KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, evt.isAutoRepeat());
  keyEvent.setTime(evt.getWhen());
  synchronized (eventQueue){
    eventQueue.add(keyEvent);
  }
}

代码示例来源:origin: jzy3d/jzy3d-api

protected java.awt.event.KeyEvent convertEvent(KeyEvent event, int eventId) {
  return new java.awt.event.KeyEvent(source, eventId, event.getWhen(), AWTToNewtUtilities.mask(event), AWTToNewtUtilities.mapKeyCode(event), event.getKeyChar());
}

代码示例来源:origin: org.jmonkeyengine/jme3-jogl

public void keyReleased(KeyEvent evt) {
  int code = convertNewtKey(evt.getKeySymbol());
  KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, evt.isAutoRepeat());
  keyEvent.setTime(evt.getWhen());
  synchronized (eventQueue) {
    eventQueue.add(keyEvent);
  }
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

@Override
public void keyPressed(KeyEvent e) {
  if (focusedWindow != null) {
    focusedWindow.sendKeyEvent(e.getEventType(), e.getModifiers(),
                  e.getKeyCode(), e.getKeySymbol(), e.getKeyChar());
  }
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

@Override
public void keyReleased(KeyEvent e) {
  if (focusedWindow != null) {
    focusedWindow.sendKeyEvent(e.getEventType(), e.getModifiers(),
                  e.getKeyCode(), e.getKeySymbol(), e.getKeyChar());
  }
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

@Override
public void keyPressed(final KeyEvent e) {
  if( !e.isPrintableKey() || e.isAutoRepeat() ) {
    return;
  }
  if(e.getKeyChar()=='r' && 0==e.getModifiers() && null!=parentWin) {
    e.setConsumed(true);
    glWindow.invokeOnNewThread(null, false, new Runnable() {
      public void run() {
        if(null == glWindow.getParent()) {
          glWindow.reparentWindow(parentWin, -1, -1, 0 /* hints */);
       } else {
          final InsetsImmutable insets = glWindow.getInsets();
          final int x, y;
          if ( 0 >= insets.getTopHeight() ) {
            // fail safe ..
            x = 32;
            y = 32;
          } else {
            x = insets.getLeftWidth();
            y = insets.getTopHeight();
          }
          glWindow.reparentWindow(null, x, y, 0 /* hints */);
          glWindow.setDefaultCloseOperation( glClosable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE );
        }
      } } );
  }
}

代码示例来源:origin: org.processing/core

keyChar = hackToChar(code, nativeEvent.getKeyChar());
} else {
 keyCode = code;
 keyChar = nativeEvent.getKeyChar();

代码示例来源:origin: jzy3d/jzy3d-api

@Override
public void keyPressed(KeyEvent e) {
  switch( e.getKeyChar()){
  case KeyEvent.VK_2: chart.getScene().getLightSet().get(lightId).getPosition().x -= 10; chart.render(); break;
  case KeyEvent.VK_8: chart.getScene().getLightSet().get(lightId).getPosition().x += 10; chart.render(); break;
  case KeyEvent.VK_4: chart.getScene().getLightSet().get(lightId).getPosition().y -= 10; chart.render(); break;
  case KeyEvent.VK_6: chart.getScene().getLightSet().get(lightId).getPosition().y += 10; chart.render(); break;
  case KeyEvent.VK_9: chart.getScene().getLightSet().get(lightId).getPosition().z += 10; chart.render(); break;
  case KeyEvent.VK_7: chart.getScene().getLightSet().get(lightId).getPosition().z -= 10; chart.render(); break;
  
  //KeyEvent.;
  default: break;
  }
}
@Override

相关文章