Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    keylistener help

    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());
    }

  • #2
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's Java code. This is the DOM sub-forum of the JavaScript forum. JavaScript and Java are two very different languages.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •