Setup JNativeHook for Maven and maven for gitpod VSCode setup.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
332973fedf
commit
03804ff586
44
.classpath
Normal file
44
.classpath
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="ignore_optional_problems" value="true"/>
|
||||||
|
<attribute name="m2e-apt" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="ignore_optional_problems" value="true"/>
|
||||||
|
<attribute name="m2e-apt" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
|
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
|
||||||
tasks:
|
tasks:
|
||||||
- init: sh ./coauthors.sh
|
- init: sh ./coauthors.sh
|
||||||
@ -5,3 +6,4 @@ vscode:
|
|||||||
extensions:
|
extensions:
|
||||||
- redhat.java
|
- redhat.java
|
||||||
- mhutchie.git-graph
|
- mhutchie.git-graph
|
||||||
|
- vscjava.vscode-maven
|
||||||
|
34
.project
Normal file
34
.project
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>ffxivai</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1633395485788</id>
|
||||||
|
<name></name>
|
||||||
|
<type>30</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
|
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
4
.settings/org.eclipse.core.resources.prefs
Normal file
4
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
2
.settings/org.eclipse.jdt.apt.core.prefs
Normal file
2
.settings/org.eclipse.jdt.apt.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.apt.aptEnabled=false
|
9
.settings/org.eclipse.jdt.core.prefs
Normal file
9
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -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
|
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
4
pom.xml
4
pom.xml
@ -24,9 +24,9 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.1stleg</groupId>
|
<groupId>com.github.kwhat</groupId>
|
||||||
<artifactId>jnativehook</artifactId>
|
<artifactId>jnativehook</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -6,13 +6,51 @@ import java.awt.GraphicsEnvironment;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
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;
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
public class App{
|
public class App{
|
||||||
public static double FRAMETIME=0;
|
public static double FRAMETIME=0;
|
||||||
public static Robot r;
|
public static Robot r;
|
||||||
public static JFrame f;
|
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) {
|
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 {
|
try {
|
||||||
r = new Robot();
|
r = new Robot();
|
||||||
} catch (AWTException e) {
|
} catch (AWTException e) {
|
||||||
|
Binary file not shown.
BIN
target/classes/sig/App.class
Normal file
BIN
target/classes/sig/App.class
Normal file
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
main/java/sig/App.class
|
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user