×

Discussion Board

Results 1 to 2 of 2

Thread: arrow keys

  1. #1
    Super Contributor
    Join Date
    Mar 2003
    Posts
    2,426

    arrow keys

    Hi, how can I use the keypad (the four arrow keys) from a personal Java application? The key listener does not seem to trap these keys...
    Any idea?

    Posted by Bruera Luca, luca.bruera@tilab.com
    on March 05, 2002 at 15:12

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Posts
    2,426

    RE: arrow keys

    Posted by Boulichkiv Dmitry, dima_boul@mail.ru
    on March 05, 2002 at 20:19



    Hello Luca again!

    Let try next:

    in constructor call
    ------------------


    addKeyListener(kl);


    ------------------
    and define KeyListener in class

    KeyListener kl = new KeyListener() {
    public void keyPressed(KeyEvent e) {
    }
    public void keyReleased(KeyEvent e) {
    switch(e.getKeyCode()){
    case e.VK_RIGHT:
    doSomething();
    break;
    case e.VK_LEFT:
    doSomething();
    break;
    case e.VK_UP:
    doSomething();
    break;
    }

    }
    public void keyTyped(KeyEvent e) {
    }
    };

Posting Permissions

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