I will print related info if users focus on current window and press a key. However, it works for some keys like \'a\' but not for \'tab\'. Here is a simple demo:
I think it should work if you put
setFocusTraversalKeysEnabled(false);
in your MainPanel constructor. At least it works for e.g. addKeyListener(...);
MainPanel
addKeyListener(...);