addKeyListener() does not working unless listener added to JFrame
public class Any extends JPanel implements KeyListener, MouseListener
/* contains all necessary listener implementations */
That panel can be added to JFrame and mouse listener works as expected and usual, but not the key listener. In order to get the key listener to work, I have to add the listener to the Frame itself:
Any any=new Any();
JFrame F=new JFrame();
Is it a bug? I find no explanation in Java Doc's...