本文整理匯總了Java中org.jnativehook.keyboard.NativeKeyEvent.NATIVE_KEY_TYPED屬性的典型用法代碼示例。如果您正苦於以下問題:Java NativeKeyEvent.NATIVE_KEY_TYPED屬性的具體用法?Java NativeKeyEvent.NATIVE_KEY_TYPED怎麽用?Java NativeKeyEvent.NATIVE_KEY_TYPED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.jnativehook.keyboard.NativeKeyEvent
的用法示例。
在下文中一共展示了NativeKeyEvent.NATIVE_KEY_TYPED屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: nativeKeyTyped
public void nativeKeyTyped(NativeKeyEvent e) {
System.out.println("Received " + e.paramString());
if (e.getID() != NativeKeyEvent.NATIVE_KEY_TYPED) {
fail("Invalid event type received for nativeKeyPressed!");
}
lastEvent = e;
synchronized(this) {
this.notifyAll();
}
try {
Field f = NativeInputEvent.class.getDeclaredField("reserved");
f.setAccessible(true);
f.setShort(e, (short) 0x01);
}
catch (Exception e1) {
e1.printStackTrace();
}
}
示例2: processKeyEvent
/**
* Processes native key events by dispatching them to all registered
* <code>NativeKeyListener</code> objects.
*
* @param e the <code>NativeKeyEvent</code> to dispatch.
* @see NativeKeyEvent
* @see NativeKeyListener
* @see #addNativeKeyListener(NativeKeyListener)
*/
protected void processKeyEvent(NativeKeyEvent e) {
int id = e.getID();
EventListener[] listeners = eventListeners.getListeners(NativeKeyListener.class);
for (int i = 0; i < listeners.length; i++) {
switch (id) {
case NativeKeyEvent.NATIVE_KEY_PRESSED:
((NativeKeyListener) listeners[i]).nativeKeyPressed(e);
break;
case NativeKeyEvent.NATIVE_KEY_TYPED:
((NativeKeyListener) listeners[i]).nativeKeyTyped(e);
break;
case NativeKeyEvent.NATIVE_KEY_RELEASED:
((NativeKeyListener) listeners[i]).nativeKeyReleased(e);
break;
}
}
}
示例3: processKeyEvent
/**
* Processes native key events by dispatching them to all registered
* <code>NativeKeyListener</code> objects.
*
* @param e the <code>NativeKeyEvent</code> to dispatch.
* @see NativeKeyEvent
* @see NativeKeyListener
* @see #addNativeKeyListener(NativeKeyListener)
*/
private void processKeyEvent(NativeKeyEvent e) {
NativeKeyListener[] listeners = eventListeners.getListeners(NativeKeyListener.class);
for (int i = 0; i < listeners.length; i++) {
switch (e.getID()) {
case NativeKeyEvent.NATIVE_KEY_PRESSED:
listeners[i].nativeKeyPressed(e);
break;
case NativeKeyEvent.NATIVE_KEY_TYPED:
listeners[i].nativeKeyTyped(e);
break;
case NativeKeyEvent.NATIVE_KEY_RELEASED:
listeners[i].nativeKeyReleased(e);
break;
}
}
}