...

View Full Version : keylistener help



froggerhelp
08-01-2006, 05:19 PM
we're making the game frogger, and we're having trouble getting keylistener to work. this is our code so far for our main program:


public class Frogger extends GraphicsProgram implements KeyListener
{
// instance variables
private Room myRoom;


public void init()
{
System.out.println("constructed frogger");
myRoom = new Room (400, 350, getGCanvas ());
this.setFocusable(true);
this.addKeyListener(this);
}
public void keyPressed(KeyEvent e){System.out.println(e.getKeyCode());}
public void keyReleased(KeyEvent e){System.out.println(e.getKeyCode());}

public void keyTyped(KeyEvent e)
{
System.out.println(e.getKeyCode());
}

Kravvitz
08-01-2006, 08:49 PM
That's Java code. This is the DOM sub-forum of the JavaScript forum. JavaScript and Java are two very different languages.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum