kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.75k stars 348 forks source link

can't loop through all the keys #410

Open martinpro1000 opened 2 years ago

martinpro1000 commented 2 years ago

I want to add all the available keys of NativeKeyEvent to an HashMap<String, Integer>(with String being .getKeyText(i); and Integer being the actual key code) and also to a ComboBox, is there any way to do that? I can't find it!

kwhat commented 2 years ago

You would need to do it for each individual key combination or use reflection.

martinpro1000 commented 2 years ago

I also created that way:

     for (int i = 0; i < 65406; i++) {
            String text = NativeKeyEvent.getKeyText(i);
            if (!text.startsWith("Unknown")) {
                disableKey.getItems().add(text);
                hashMap.put(text, i);
            }
        }