test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
38
.config/Code/User/History/22e92be3/06wx.java
Normal file
38
.config/Code/User/History/22e92be3/06wx.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
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();
|
||||
}
|
||||
}
|
38
.config/Code/User/History/22e92be3/4cji.java
Normal file
38
.config/Code/User/History/22e92be3/4cji.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
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();
|
||||
}
|
||||
}
|
54
.config/Code/User/History/22e92be3/5yQh.java
Normal file
54
.config/Code/User/History/22e92be3/5yQh.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
ProcessBuilder builder = new ProcessBuilder("hello");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
42
.config/Code/User/History/22e92be3/73Eq.java
Normal file
42
.config/Code/User/History/22e92be3/73Eq.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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 GlobalKeyListener());
|
||||
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.shutdown();
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
55
.config/Code/User/History/22e92be3/7BIl.java
Normal file
55
.config/Code/User/History/22e92be3/7BIl.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
Process process = Runtime.getRuntime();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
51
.config/Code/User/History/22e92be3/7Bf2.java
Normal file
51
.config/Code/User/History/22e92be3/7Bf2.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
62
.config/Code/User/History/22e92be3/7Pge.java
Normal file
62
.config/Code/User/History/22e92be3/7Pge.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("hello");
|
||||
Process process = builder.start();
|
||||
process.waitFor();
|
||||
}
|
||||
catch (IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
39
.config/Code/User/History/22e92be3/9aH8.java
Normal file
39
.config/Code/User/History/22e92be3/9aH8.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();
|
||||
}
|
||||
}
|
38
.config/Code/User/History/22e92be3/BHcD.java
Normal file
38
.config/Code/User/History/22e92be3/BHcD.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
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();
|
||||
}
|
||||
}
|
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();
|
||||
}
|
||||
}
|
65
.config/Code/User/History/22e92be3/Cfrz.java
Normal file
65
.config/Code/User/History/22e92be3/Cfrz.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("firefox");
|
||||
Process process = builder.start();
|
||||
process.waitFor();
|
||||
}
|
||||
catch(IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
catch(InterruptedException e2){
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
39
.config/Code/User/History/22e92be3/Eu88.java
Normal file
39
.config/Code/User/History/22e92be3/Eu88.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 GlobalKeyListener 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();
|
||||
}
|
||||
}
|
51
.config/Code/User/History/22e92be3/K22k.java
Normal file
51
.config/Code/User/History/22e92be3/K22k.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
44
.config/Code/User/History/22e92be3/KRWU.java
Normal file
44
.config/Code/User/History/22e92be3/KRWU.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.registerNativeHook();
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
65
.config/Code/User/History/22e92be3/LNsq.java
Normal file
65
.config/Code/User/History/22e92be3/LNsq.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
System.out.println("Shift pressed");
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("firefox");
|
||||
Process process = builder.start();
|
||||
process.waitFor();
|
||||
}
|
||||
catch(IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
catch(InterruptedException e2){
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
42
.config/Code/User/History/22e92be3/MyIv.java
Normal file
42
.config/Code/User/History/22e92be3/MyIv.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.shutdown();
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
65
.config/Code/User/History/22e92be3/Nm3P.java
Normal file
65
.config/Code/User/History/22e92be3/Nm3P.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("hello");
|
||||
Process process = builder.start();
|
||||
process.waitFor();
|
||||
}
|
||||
catch(IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
catch(InterruptedException e2){
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
44
.config/Code/User/History/22e92be3/UBZO.java
Normal file
44
.config/Code/User/History/22e92be3/UBZO.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.shutdown();
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
51
.config/Code/User/History/22e92be3/WWQx.java
Normal file
51
.config/Code/User/History/22e92be3/WWQx.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
54
.config/Code/User/History/22e92be3/X596.java
Normal file
54
.config/Code/User/History/22e92be3/X596.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
ProcessBuilder builder = new ProcessBuilder("hello");
|
||||
Process process = builder.start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
39
.config/Code/User/History/22e92be3/Y1jO.java
Normal file
39
.config/Code/User/History/22e92be3/Y1jO.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 GlobalKeyListener 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();
|
||||
}
|
||||
}
|
54
.config/Code/User/History/22e92be3/YP1z.java
Normal file
54
.config/Code/User/History/22e92be3/YP1z.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
61
.config/Code/User/History/22e92be3/bZLJ.java
Normal file
61
.config/Code/User/History/22e92be3/bZLJ.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("hello");
|
||||
Process process = builder.start();
|
||||
}
|
||||
catch (IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
44
.config/Code/User/History/22e92be3/dJNO.java
Normal file
44
.config/Code/User/History/22e92be3/dJNO.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
1
.config/Code/User/History/22e92be3/entries.json
Normal file
1
.config/Code/User/History/22e92be3/entries.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Coding/Java/keypress-getter/src/main/java/com/rutils/GlobalKeyListener.java","entries":[{"id":"BHcD.java","source":"Workspace Edit","timestamp":1717060416728},{"id":"06wx.java","source":"renamed.source","timestamp":1717060416953},{"id":"4cji.java","timestamp":1717060431628},{"id":"pugN.java","timestamp":1717060450185},{"id":"9aH8.java","timestamp":1717060465628},{"id":"BkM5.java","timestamp":1717060489998},{"id":"Eu88.java","timestamp":1717060559931},{"id":"Y1jO.java","source":"renamed.source","timestamp":1717060560216},{"id":"o8eV.java","timestamp":1717060569938},{"id":"zEVY.java","timestamp":1717060592142},{"id":"73Eq.java","timestamp":1717060605608},{"id":"MyIv.java","timestamp":1717060619605},{"id":"UBZO.java","timestamp":1717060645968},{"id":"KRWU.java","timestamp":1717060663468},{"id":"dJNO.java","timestamp":1717060702212},{"id":"xP3J.java","timestamp":1717060721608},{"id":"kMXp.java","timestamp":1717060740468},{"id":"7Bf2.java","timestamp":1717060753122},{"id":"K22k.java","timestamp":1717060977943},{"id":"WWQx.java","timestamp":1717061004053},{"id":"7BIl.java","timestamp":1717061280056},{"id":"YP1z.java","timestamp":1717061309739},{"id":"5yQh.java","timestamp":1717061440655},{"id":"X596.java","timestamp":1717061462688},{"id":"bZLJ.java","timestamp":1717061487145},{"id":"7Pge.java","timestamp":1717061497661},{"id":"Nm3P.java","timestamp":1717061515991},{"id":"uNQ6.java","timestamp":1717061530338},{"id":"Cfrz.java","timestamp":1717061720364},{"id":"iI1Q.java","timestamp":1717065454631},{"id":"LNsq.java","timestamp":1717065587584}]}
|
65
.config/Code/User/History/22e92be3/iI1Q.java
Normal file
65
.config/Code/User/History/22e92be3/iI1Q.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("firefox");
|
||||
Process process = builder.start();
|
||||
process.waitFor();
|
||||
}
|
||||
catch(IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
catch(InterruptedException e2){
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
52
.config/Code/User/History/22e92be3/kMXp.java
Normal file
52
.config/Code/User/History/22e92be3/kMXp.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
39
.config/Code/User/History/22e92be3/o8eV.java
Normal file
39
.config/Code/User/History/22e92be3/o8eV.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 GlobalKeyListener 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 GlobalKeyListener());
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.shutdown();
|
||||
}
|
||||
}
|
38
.config/Code/User/History/22e92be3/pugN.java
Normal file
38
.config/Code/User/History/22e92be3/pugN.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
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();
|
||||
}
|
||||
}
|
65
.config/Code/User/History/22e92be3/uNQ6.java
Normal file
65
.config/Code/User/History/22e92be3/uNQ6.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.NativeHookException;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener implements NativeKeyListener{
|
||||
public void nativeKeyPressed(NativeKeyEvent e){
|
||||
if(e.getKeyCode() == NativeKeyEvent.VC_SHIFT){
|
||||
|
||||
try{
|
||||
ProcessBuilder builder = new ProcessBuilder("firefox");
|
||||
Process process = builder.start();
|
||||
process.waitFor();
|
||||
}
|
||||
catch(IOException e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
catch(InterruptedException e2){
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nativeKeyReleased(NativeKeyEvent e){}
|
||||
public void nativeKeyTyped(NativeKeyEvent e){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
|
||||
try{
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
}
|
||||
catch(NativeHookException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
45
.config/Code/User/History/22e92be3/xP3J.java
Normal file
45
.config/Code/User/History/22e92be3/xP3J.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
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(this);
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.removeNativeKeyListener(this);
|
||||
GlobalScreen.unregisterNativeHook();
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
}
|
||||
}
|
44
.config/Code/User/History/22e92be3/zEVY.java
Normal file
44
.config/Code/User/History/22e92be3/zEVY.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package com.rutils;
|
||||
|
||||
import org.jnativehook.GlobalScreen;
|
||||
import org.jnativehook.keyboard.NativeKeyEvent;
|
||||
import org.jnativehook.keyboard.NativeKeyListener;
|
||||
|
||||
public class GlobalKeyListener 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){}
|
||||
|
||||
GlobalKeyListener(){
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
new GlobalKeyListener();
|
||||
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 GlobalKeyListener());
|
||||
|
||||
try{
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch(InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlobalScreen.shutdown();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue