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


Java KeyEvent.getKeyCode方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:17,代码来源:InteractionAnnotate.java

示例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);
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:26,代码来源:InputController.java

示例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;
    }
}
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:21,代码来源:KeyListener.java

示例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();
        }
    }
 
开发者ID:WhiteHexagon,项目名称:example-jovr-jogl-rift,代码行数:23,代码来源:RiftClient0440.java

示例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;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:12,代码来源:EngineTest.java

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

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

示例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;
        });
    }
}
 
开发者ID:sgs-us,项目名称:microtrafficsim,代码行数:10,代码来源:ScenarioAreaOverlay.java

示例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();
    }
}
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:9,代码来源:HelloTriangle.java

示例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;
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-hello-vr,代码行数:12,代码来源:Application.java

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

示例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;
    }
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:11,代码来源:Test.java

示例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;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:12,代码来源:EngineTest.java

示例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;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:12,代码来源:PhysicsTest1.java

示例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;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:12,代码来源:PhysicsTest1.java


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