0

Is the Java KeyListener universal meaning that it will work for any application that I type into?

If not, how can I make it universal?

0

2 Answers 2

2

It is not universal. It only works if the component you registered it for has focus. You can use keyboard hooks to make it universal, but you will either have to use JNI or JNA to integrate the native code.

Sign up to request clarification or add additional context in comments.

Comments

1

Please define "universal". Do you mean will it work as a key-logger? Answer: no. For that you'd need to write a key board hook that would be plugged into the operating system, something that can be done with Java via JNI or JNA, but something that Java is not well suited for.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.