OK i have a class that extends JPanel and implements runnable, KeyListener. It has a animation - which is just moving a image. My goal here is to be able to control that animation with arrow keys. Problem is that when i press my keys - nothing happens. I can't find what is the problem. Hope somebody can help me.
[ March 07, 2004: Message edited by: Juhan Voolaid ]
thnxs - didn't notice those errors, but the key events still don't happen. I allso have println() functions for keyPressed() method, but still there is something wrong.
OK .. i think i do it with threads, but my keyevents still don't work. Does anybody notice what's wrong with my code or know any good tutorial? Ithink i have problems in focusing this JPanel. [ March 07, 2004: Message edited by: Juhan Voolaid ]
OK finally i solved the problem and in conclusion I say what was wrong. Problem was that my JPanel lost focus because after this JPanel was initialased some other GUI components were created. So the focus was on last created component. I got it working when i put super.requestFocus(); to the paintComponent() method in this JPanel class.