本文整理匯總了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);
}
}
示例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();
}
}
}
示例3: nativeKeyPressed
public void nativeKeyPressed(NativeKeyEvent e) {
if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
try {
GlobalScreen.unregisterNativeHook();
System.exit(1);
} catch (NativeHookException e1) {
}
}
}
示例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);
}
}
}
示例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();
}
});
}
}