Arrow Key Input


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Arrow Key Input

  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Arrow Key Input

    Alright, i cannot figure out for the life of me how to take arrow key input. The only thing i've found on it is how to do it regarding an applet. My program is not an applet... so it didn't work when I tried it. Any suggestions?

    Thanks
    Runesoul

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    Is this a command line input? If so, i'm not sure you can get the arrow key. If you're using a keylistener then it should work. You'll have to look in the KeyEvent API to see.

  3. #3
    Join Date
    Jan 2004
    Posts
    7
    My program is running in a Frame. I looked at the KeyEvent API and it seemed like you had to have something to take focus before you can use a key listener. This presents a problem for me because all I have in the Frame are Images...

    Anyone know of a way I could get around this?

    Runesoul

  4. #4
    Join Date
    Feb 2004
    Posts
    541
    You can make the frame request focus. Look in the API for Frame, the method will either be in there on one of the superclasses....

  5. #5
    Join Date
    Mar 2004
    Posts
    635
    implement the KeyListener interface in a class and add it

    MyFrame.addKeyListener()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center