test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
39
.config/Code/User/History/22e92be3/BkM5.java
Normal file
39
.config/Code/User/History/22e92be3/BkM5.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListenerExample implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
System.out.println("Shift key pressed");
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
public static void main(String[] args){
|
||||
try{
|
||||
GlobalScreen.registerNativeHook();
|
||||
}
|
||||
catch(Exception ex){
|
||||
System.err.println("There was a problem registering the native hook.");
|
||||
System.err.println(ex.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
GlobalScreen.addNativeKeyListener(new GlobalKeyListenerExample());
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.shutdown();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue