KeyListener vs. Runnable ???

J

JariTapio

-!Hei!-

Im makin a hot INVADERS game with Java
but im a newbie with language, so , question is
how do i use KeyPressed () function...

I hav Applet Runnable and I dont know how to
use keylistener when you use Applet Runnable...

Thank you a lot for your help...
 
J

JariTapio

-!Hei!-

Here is my problem...

public class TestinKeys extends Applet implements Runnable
....
....
public void run ()
{
while ( true )
{
KeyEvent ke;
if ( ke.getKeyChar() == 'a' ) g_TykkiX ++;
....
....

What is Wrong, im tryin to make that Invaders game but i dont know
how to read keyboard with Runnable Java code...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top