My KeyListener is not Working!!
Okay, i have started my 2d game (im making loads as a exercise - this is my 2nd one...) and i have implented ActionListener on my class and made the actionPerformed class blah blah....
that is all working but the problem im having is with this...
I have used addKeyListner(new AL()); in my constructor, then at the bottom of my clas (still inside the paramenter) i have use 'private class AL extends KeyAdapter' and in that class i have used 'keyPressed' and 'keyReleased' methods, but they are not being called when i press a key/....
---
I cant post the code because im on my laptop, although if anyone knows why they may not be called please help out....
P.S.
also if anyone can help me out by telling me their Xfire or MSN account and they can help me out through there to fix this problem and a few others i got , that wuld be absolutely great!
Re: My KeyListener is not Working!!
The component where the keylistener is installed needs to have focus for the events to be registered. Try calling requestFocus() on the component that you register your key listener with
Re: My KeyListener is not Working!!
haha, i used setFocusable(true); and it is working...thanks!
Im glad and annoyed...its now 10:00pm on sunday night so thats the whole of weekend wasted because i culdnt fix it over weekend :-(...
i guess ill spend hour or so on making a game then go bed :P
--thanks alot !!