PDA

View Full Version : Keyboard and JBuilder



jfreak53
09-20-2008, 03:17 PM
I'm designing a small game for a project of mine, but I have searched all over the net and I can't find this info. All I need to do is be able to use the keyboard arrows to move an object, very simple but I can't find this anywhere? I am using JBuilder.

Thanks in advance.

peter_budo
09-20-2008, 06:48 PM
Well little more throughout search next time :p
KeyEvent() (http://java.sun.com/javase/6/docs/api/java/awt/event/KeyEvent.html)

VK UP (http://java.sun.com/javase/6/docs/api/java/awt/event/KeyEvent.html#VK_UP) - Constant for the non-numpad up arrow key.
VK DOWN (http://java.sun.com/javase/6/docs/api/java/awt/event/KeyEvent.html#VK_DOWN) - Constant for the non-numpad down arrow key.
VK LEFT (http://java.sun.com/javase/6/docs/api/java/awt/event/KeyEvent.html#VK_LEFT) - Constant for the non-numpad left arrow key.
VK RIGHT (http://java.sun.com/javase/6/docs/api/java/awt/event/KeyEvent.html#VK_RIGHT) - Constant for the non-numpad right arrow key.

Nice tutorial at Sun Java website How to Write a Key Listener (http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html) :eek: