My, we have a lot of compiler errors in that code! Have you come across the Java Tutorials yet? I think that link will help you
I think the bit you have missed out is that you have to add the Listener to something.
Joined: Oct 13, 2005
Once I got rid of the many compiler errors, btnA.addKeyListener(this); seemed to do the trick. I had to click the button so it gained focus, then push a key.
Joined: Jan 24, 2013
If I attach the KeyListener to the button I have no problem. I need or would like anyway to attach it to the Frame or Container... I have alot of JButtons on the form and would rather not have to attach a KeyListener to all of them. I'd rather attach it to the Frame and then press the appropriate button...