No Description

Matt Clark 4e039d8ff4 Refactoring out interfaces; adjusting POM for Central upload. 9 months ago
src 4e039d8ff4 Refactoring out interfaces; adjusting POM for Central upload. 9 months ago
README.md 7dcc0f849c Ading README, prevent multiple listener attachements, events on KeyUp. 10 months ago
pom.xml 4e039d8ff4 Refactoring out interfaces; adjusting POM for Central upload. 9 months ago

README.md

KeyHook

A Java/Native global keyboard hook.

Usage

Using the library is as simple as adding a Maven dependency and a few lines to handle the events.

Maven

<dependency>
    <groupId>com.mclarkdev.tools</groupId>
    <artifactId>KeyHook</artifactId>
    <version>1.0</version>
</dependency>

Java

Create an EventListener to handle the keyboard events.

private EventListener eventListener = new EventListener() {

    @Override
    public void onEvent(ArrayList<Integer> keyMap) {

        String keys = keyMap.stream().map(Object::toString)//
                .collect(Collectors.joining(", "));

        System.out.println("Keys:" + keys);
    }
};

Attach the listener to the KeyboardManager.

KeyboardManager.getInstance().attachListener(eventListener);