KeyListener

Hey

I have a game with a jframe as main. That jframe contains a jdesktoppane which itself contains some jinternalframes.
I have added several listeren to the jdesktop pane (keyboard, mouse, mousemotion, mousewheel) but hte keyboardlistener doesnt react
However when i add i to the jframe it reacts. All the mouselisteners do react when i add them to the jdesktoppane. This would not be a problem
if the keyboardlistenener kept on reacting. How ever when i click a button on an jinternalframe my keys stop reacting as well. As for the
mouselisteners there is never a problem. How can i still add the keylistener to the jdesktoppane and keep it reacting?

thx

Is it focusable? Does it get the focus?

is tried using grabFocus();
but without anysuccess

But that doesn’t tell you whether it gets focus. Find out whether it actually has focus. Note: TextComponents generally claim focus from other components.

no it hasnt. How can i focus it then if grabFocus doenst work?

solved the problme thx for al the replies

Okay, if you share the solution then someone might benefit from it (unless it was utterly irrelevant :slight_smile: )

i used grabFocus when creating the desktoppane but that focus was lost afterwards bcz the main frame underwent some changes

so i just used grabfocus at the end and then it works