Image

Imagetimwi wrote in Imagejava_dev

global KeyListener?

Hi,

I have added a KeyListener to my window using addKeyListener(). So far this has worked all right. Just now, however, I have put a button on the window, and it seems that the KeyListener no longer fires. If I take the button out again, it works again.

I think it might be because the button "eats up" the keystrokes and doesn't pass them on to the parent window. Is there any way I can set up a KeyListener that will work for the entire window, no matter what element in it has keyboard focus?

I really don't want to have to add that same KeyListener to all the buttons and other elements that I'm going to add to that window.

Thanks in advance.