本文整理汇总了Java中com.jogamp.newt.event.KeyEvent.getKeyCode方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.getKeyCode方法的具体用法?Java KeyEvent.getKeyCode怎么用?Java KeyEvent.getKeyCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.newt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.getKeyCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if (code == KeyEvent.VK_BACK_SPACE || code == KeyEvent.VK_DELETE) {
if (activeIndex >= 0) {
annotateables.remove(activeIndex);
}
activeIndex = annotateables.size() - 1;
Displayer.display();
} else if (code == KeyEvent.VK_N && activeIndex >= 0) {
activeIndex++;
activeIndex %= annotateables.size();
Displayer.display();
}
}
示例2: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e) {
int code = e.getKeyCode();
switch (code) {
case 0xd:
code = java.awt.event.KeyEvent.VK_ENTER;
break;
case 0x95:
code = java.awt.event.KeyEvent.VK_LEFT;
break;
case 0x97:
code = java.awt.event.KeyEvent.VK_RIGHT;
break;
default:
break;
}
KeyStroke keyStroke = KeyStroke.getKeyStroke(code, e.getModifiers());
if (KeyShortcuts.handleKeyStroke(keyStroke, e.getSource(), java.awt.event.KeyEvent.KEY_PRESSED))
return;
ImageViewerGui.getCurrentInteraction().keyReleased(e);
for (KeyListener listener : keyListeners)
listener.keyReleased(e);
}
示例3: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch(ke.getKeyCode()){
case KeyEvent.VK_A:
float ambientIntensity = Tutorial17.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity += step;
Tutorial17.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial17.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity -= step;
Tutorial17.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
}
}
示例4: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyReleased(KeyEvent e) {
System.out.println("hmd.getHSWDisplayState().Displayed=" + hmd.getHSWDisplayState().Displayed);
if (!hswDone && hmd.getHSWDisplayState().Displayed == 1) {
hmd.dismissHSWDisplay();
hswDone = true;
}
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
shutdown();
}
if (e.getKeyCode() == KeyEvent.VK_F5) {
// new Thread() {
// public void run() {
// glWindow.setFullscreen(!glWindow.isFullscreen());
// }
// }.start();
}
if (e.getKeyCode() == KeyEvent.VK_R) {
recenterView();
}
}
示例5: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
char keyChar = Character.toLowerCase(e.getKeyChar());
if (keyChar == 'w') keyW = false;
if (keyChar == 'a') keyA = false;
if (keyChar == 's') keyS = false;
if (keyChar == 'd') keyD = false;
if (keyCode == KeyEvent.VK_LEFT) keyLeft = false;
if (keyCode == KeyEvent.VK_RIGHT) keyRight = false;
if (keyCode == KeyEvent.VK_UP) keyUp = false;
}
示例6: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
synchronized (this.keys) {
if (this.keys.containsKey(keyCode)) {
this.keys.get(keyCode).press();
}
}
// e.consume();
}
示例7: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
synchronized (this.keys) {
if (this.keys.containsKey(keyCode)) {
if (keyCode == KeyEvent.VK_SHIFT) {
this.keys.get(keyCode).reset();
} else {
this.keys.get(keyCode).release();
}
}
}
// e.consume();
}
示例8: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
ui.getContext().addTask(c -> {
completeAreaInConstruction();
return null;
});
}
}
示例9: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
new Thread(() -> {
window.destroy();
}).start();
}
}
示例10: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
quit();
break;
case KeyEvent.VK_C:
showCubes = !showCubes;
break;
}
}
示例11: processSingleKeyToggableEvents
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
private void processSingleKeyToggableEvents(KeyEvent pE,
final Collection<?> lOverlays)
{
boolean lHasAnyOverlayBeenToggled = false;
for (final Object lOverlay : lOverlays)
if (lOverlay instanceof SingleKeyToggable)
{
final SingleKeyToggable lSingleKeyToggable = (SingleKeyToggable) lOverlay;
final boolean lRightKey =
pE.getKeyCode() == lSingleKeyToggable.toggleKeyCode();
final boolean lRightModifiers =
pE.getModifiers() == lSingleKeyToggable.toggleKeyModifierMask();
// (pE.getModifiers() &
// lSingleKeyToggable.toggleKeyModifierMask()) ==
// lSingleKeyToggable.toggleKeyModifierMask();
if (lRightKey && lRightModifiers)
{
lSingleKeyToggable.toggle();
lHasAnyOverlayBeenToggled = true;
}
}
if (lHasAnyOverlayBeenToggled)
mClearVolumeRenderer.notifyChangeOfVolumeRenderingParameters();
}
示例12: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
animator.stop();
glWindow.destroy();
break;
}
}
示例13: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
char keyChar = Character.toLowerCase(e.getKeyChar());
if (keyChar == 'w') keyW = true;
if (keyChar == 'a') keyA = true;
if (keyChar == 's') keyS = true;
if (keyChar == 'd') keyD = true;
if (keyCode == KeyEvent.VK_LEFT) keyLeft = true;
if (keyCode == KeyEvent.VK_RIGHT) keyRight = true;
if (keyCode == KeyEvent.VK_UP) keyUp = true;
}
示例14: keyPressed
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) keyLeft = true;
if (keyCode == KeyEvent.VK_RIGHT) keyRight = true;
if (keyCode == KeyEvent.VK_UP) keyUp = true;
if (keyCode == KeyEvent.VK_DOWN) keyDown = true;
if (keyCode == KeyEvent.VK_A) keyA = true;
if (keyCode == KeyEvent.VK_D) keyD = true;
if (keyCode == KeyEvent.VK_W) keyW = true;
if (keyCode == KeyEvent.VK_S) keyS = true;
}
示例15: keyReleased
import com.jogamp.newt.event.KeyEvent; //导入方法依赖的package包/类
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) keyLeft = false;
if (keyCode == KeyEvent.VK_RIGHT) keyRight = false;
if (keyCode == KeyEvent.VK_UP) keyUp = false;
if (keyCode == KeyEvent.VK_DOWN) keyDown = false;
if (keyCode == KeyEvent.VK_A) keyA = false;
if (keyCode == KeyEvent.VK_D) keyD = false;
if (keyCode == KeyEvent.VK_W) keyW = false;
if (keyCode == KeyEvent.VK_S) keyS = false;
}