I want to make a program that analysises which key has been pressed the most as a part of my school assignment. I want that the key input be recieved by my program and later by the program it was intended for. Is there a way to do this? Please describe with a sample piece of code if it is possible. Thanks in advance!

key input be recieved by my program and later by the program it was intended for.

Java can't detect events sent to other programs.

OK. I'd then check with some other language. Thanks.