當前位置: 首頁>>代碼示例>>Java>>正文


Java NativeKeyEvent.VC_ESCAPE屬性代碼示例

本文整理匯總了Java中org.jnativehook.keyboard.NativeKeyEvent.VC_ESCAPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java NativeKeyEvent.VC_ESCAPE屬性的具體用法?Java NativeKeyEvent.VC_ESCAPE怎麽用?Java NativeKeyEvent.VC_ESCAPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.jnativehook.keyboard.NativeKeyEvent的用法示例。


在下文中一共展示了NativeKeyEvent.VC_ESCAPE屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: nativeKeyPressed

@Override
public void nativeKeyPressed(NativeKeyEvent nativeKeyEvent)
{
    //FIXME this is a temporary implementation
    //TODO use some user defined lookup table for key mappings
    //System.out.println("Key pressed: " + nativeKeyEvent.getKeyCode());
    //this seems to do key repeats as well. Convenient
    switch(nativeKeyEvent.getKeyCode())
    {
        case 30://a
            keyAction(KeyEvent.simMouseScrollUp);
            break;
        case 44://z
            keyAction(KeyEvent.simMouseScrollDown);
            break;
        case 45://x
            keyAction(KeyEvent.simMouseMiddle);
            break;
        case NativeKeyEvent.VC_ESCAPE:
            keyAction(KeyEvent.hideWindow);
            break;
        case NativeKeyEvent.VC_ENTER:
            keyAction(KeyEvent.advanceText);
    }
}
 
開發者ID:thatdude624,項目名稱:Spark-Reader,代碼行數:25,代碼來源:JNativeKeyHandler.java

示例2: nativeKeyPressed

@Override
public void nativeKeyPressed(NativeKeyEvent e) {
    System.out.println("Key Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode()));

    if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
        try {
            GlobalScreen.unregisterNativeHook();
        } catch (NativeHookException ex) {
            ex.printStackTrace();
        }
    }
}
 
開發者ID:maximova136,項目名稱:j-demo,代碼行數:12,代碼來源:Main.java

示例3: nativeKeyPressed

public void nativeKeyPressed(NativeKeyEvent e) {

		if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
			try {
				GlobalScreen.unregisterNativeHook();
				System.exit(1);
			} catch (NativeHookException e1) {

			}
		}
	}
 
開發者ID:shiyafeng,項目名稱:foolqq,代碼行數:11,代碼來源:GlobalKeyListener.java

示例4: nativeKeyPressed

@Override
public void nativeKeyPressed(NativeKeyEvent e) {
    System.out.println("Key Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode()));

    if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
        try {
            GlobalScreen.unregisterNativeHook();
        } catch (NativeHookException ex) {
            Logger.getLogger(GlobalKeyListenerExample.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:12,代碼來源:GlobalKeyListenerExample.java

示例5: nativeKeyPressed

public void nativeKeyPressed(NativeKeyEvent e) {
    if (e.getKeyCode() == NativeKeyEvent.VC_PRINTSCREEN
            && ((e.getModifiers() & NativeKeyEvent.SHIFT_L_MASK) == NativeKeyEvent.SHIFT_L_MASK ||
            (e.getModifiers() & NativeKeyEvent.SHIFT_R_MASK) == NativeKeyEvent.SHIFT_R_MASK
    )) {
        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                screenSelectorShell.setPanel(new VideoCaptureTool(processor));
                screenSelectorShell.open();
            }
        });
    } else if (e.getKeyCode() == NativeKeyEvent.VC_PRINTSCREEN) {
        if ((e.getModifiers() & NativeKeyEvent.CTRL_L_MASK) == NativeKeyEvent.CTRL_L_MASK ||
                (e.getModifiers() & NativeKeyEvent.CTRL_R_MASK) == NativeKeyEvent.CTRL_R_MASK
                ) {
            Display.getDefault().asyncExec(new Runnable() {
                @Override
                public void run() {
                    ImageCaptureTool imageCaptureTool = new ImageCaptureTool(config, iconManager, processor);
                    imageCaptureTool.open(Display.getDefault().getBounds());
                }
            });
            return;
        }
        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                screenSelectorShell.setPanel(new ImageCaptureTool(config, iconManager, processor));
                screenSelectorShell.open();
            }
        });
    }
    if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                screenSelectorShell.close();
            }
        });
    }
}
 
開發者ID:kamil-karkus,項目名稱:EasySnap,代碼行數:42,代碼來源:GlobalKeyListener.java


注:本文中的org.jnativehook.keyboard.NativeKeyEvent.VC_ESCAPE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。