'Capture all key strokes from JFrame

So I am having problem with InputMap and Keystrokes as they are not working. So I want to capture all keyevent pressed inside frame doesn't matter on which component they are generated.

Please don't give suggestions about key binding as I had already used and found it useless :(

Thanks for help in advance :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source