From 03804ff586c8a6ff4959d2e3a1a0f6acc39b9da5 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Tue, 5 Oct 2021 00:59:21 +0000 Subject: [PATCH] Setup JNativeHook for Maven and maven for gitpod VSCode setup. Co-authored-by: sigonasr2 --- .classpath | 44 ++++++++++++++++++ .gitpod.yml | 4 +- .project | 34 ++++++++++++++ .settings/org.eclipse.core.resources.prefs | 4 ++ .settings/org.eclipse.jdt.apt.core.prefs | 2 + .settings/org.eclipse.jdt.core.prefs | 9 ++++ .settings/org.eclipse.m2e.core.prefs | 4 ++ pom.xml | 6 +-- src/main/java/sig/App.java | 38 +++++++++++++++ target/classes/main/java/sig/App.class | Bin 2250 -> 0 bytes target/classes/sig/App.class | Bin 0 -> 1294 bytes .../compile/default-compile/createdFiles.lst | 1 - target/test-classes/sig/AppTest.class | Bin 453 -> 453 bytes 13 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.apt.core.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs delete mode 100644 target/classes/main/java/sig/App.class create mode 100644 target/classes/sig/App.class diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..71f5fef --- /dev/null +++ b/.classpath @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitpod.yml b/.gitpod.yml index a248717..6f2ade5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,7 +1,9 @@ +--- # List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ tasks: - init: sh ./coauthors.sh vscode: extensions: - redhat.java - - mhutchie.git-graph \ No newline at end of file + - mhutchie.git-graph + - vscjava.vscode-maven diff --git a/.project b/.project new file mode 100644 index 0000000..5498e6d --- /dev/null +++ b/.project @@ -0,0 +1,34 @@ + + + ffxivai + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1633395485788 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..f9fe345 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000..d4313d4 --- /dev/null +++ b/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b11489f --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pom.xml b/pom.xml index aea6cb0..a0f9db8 100644 --- a/pom.xml +++ b/pom.xml @@ -24,10 +24,10 @@ test - com.1stleg + com.github.kwhat jnativehook - 2.1.0 - + 2.2.0 + diff --git a/src/main/java/sig/App.java b/src/main/java/sig/App.java index a25f53d..bf15260 100644 --- a/src/main/java/sig/App.java +++ b/src/main/java/sig/App.java @@ -6,13 +6,51 @@ import java.awt.GraphicsEnvironment; import java.awt.image.BufferedImage; import java.io.IOException; +import com.github.kwhat.jnativehook.GlobalScreen; +import com.github.kwhat.jnativehook.NativeHookException; +import com.github.kwhat.jnativehook.keyboard.NativeKeyEvent; +import com.github.kwhat.jnativehook.keyboard.NativeKeyListener; + import javax.swing.JFrame; public class App{ public static double FRAMETIME=0; public static Robot r; public static JFrame f; + public static void nativeKeyPressed(NativeKeyEvent e) { + System.out.println("Key Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode())); + + if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) { + try { + GlobalScreen.unregisterNativeHook(); + } catch (NativeHookException nativeHookException) { + nativeHookException.printStackTrace(); + } + } + } + + public static void nativeKeyReleased(NativeKeyEvent e) { + System.out.println("Key Released: " + NativeKeyEvent.getKeyText(e.getKeyCode())); + } + + public static void nativeKeyTyped(NativeKeyEvent e) { + System.out.println("Key Typed: " + e.getKeyText(e.getKeyCode())); + } + public static void main(String[] args) { + try { + GlobalScreen.registerNativeHook(); + } + catch (NativeHookException 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 { r = new Robot(); } catch (AWTException e) { diff --git a/target/classes/main/java/sig/App.class b/target/classes/main/java/sig/App.class deleted file mode 100644 index d2553022765fdd72a9844b1cb1584dd4a71dddfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2250 zcmai0TT>Hf7=9K48`kAu2*Cs5qE_QEXsvA(m7v5%PL@!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eO6;eBAaHUl-Ec*vXl1=|`@ZEmHZw_w_ZLh*m@zw2w>9GqFQ`98 z0aIetDp$)3mYs7}#+<61W2?nB>z;i*HmYOu4-xVJ%(EzR{TZwc;-L{Gee@|=ejoa5RafV=oD0`&R=oX2~- zb>ITtCnA|2Q%wu^L$A@Y_zJBr5qgI3pvh`cnyN+CNt##-ZvGGAb__89 diff --git a/target/classes/sig/App.class b/target/classes/sig/App.class new file mode 100644 index 0000000000000000000000000000000000000000..532d171924450a3775361b0b5372b23b867ecb82 GIT binary patch literal 1294 zcmbVL+iuf95S>j!ow)ZKcj&ehNQ+cIlou$fR7#2hX^YZOfp}Uw(_|alYppkF@=1IF z5=ijQM;af1|56-(ahIcH{$$3K64{SE*d@Wg@~11pwIXFG~4$TOHe5nbWv&Q&kz_ zekX8I*9GOzV796};U5Vtll}Q&-n3*)URTdQ2DvsJQr%soq~1~N7#j?pm8#^3)0C#w zah>*QOBmN!O57Z*{RT-2Bx?Ww literal 0 HcmV?d00001 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index f664d41..e69de29 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1 +0,0 @@ -main/java/sig/App.class diff --git a/target/test-classes/sig/AppTest.class b/target/test-classes/sig/AppTest.class index 779c0f95dce069149cace15972e4610b36c2b46d..b212b59ac7c9a49830374287f55f989663996430 100644 GIT binary patch delta 289 zcmZurxoQGY6g_v=+J1JdSj4GlW-F1K{$-`%V%Qxg~02? z!?@@Q?1#pOzS z_04lUFoNK4wYfWpJJ5ddC^yriZ@yVQB delta 261 zcmZusI|{;35S&e35`D)1Uj(sJEFO{*cmff`LaQht7(^ve8(S|Rp2SWp>}))gxUsRZ znVs30U3Q=PQ*XT9_Xhw6bqRsIL;*z$B@5+qzj7X(E=g+6Y#1;tRBTjHBc!6GuLj%g z*o$_AT;LvDwQ|?K8qNc65w|v>uY&!0xl@BE@e<%ts`Ce z1PuvB6T~QyWVFBBV3lG;tW8c?%pF#7&JZ_fzhTKX_yd9Bp9N|5;`JG>ge;?m+y_EA BBvJqX