Results 1 to 4 of 4
Thread: Need help with KeyListener
- 09-15-2012, 10:29 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 2
- Rep Power
- 0
Need help with KeyListener
I am making an applet game and I want do be able to control a cube using the wasd keys.
I don't want the KeyListener to be in the Main class but I'm not sure how this is done.
In my Main class I can add the KeyListener, but if I try to add it in the other class (Player.class) it says "The method addKeyListener is undefined for the type Player".
Anyone knows why this is?
-
Re: Need help with KeyListener
If this is a Swing application, then don't use KeyListeners but rather use Key Bindings. You can find a good tutorial via Google and can also find many examples in previous posts in this forum.
- 09-16-2012, 04:49 AM #3
Re: Need help with KeyListener
Also, any future Swing related questions that you nay have should be posted in the AWT/Swing section.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-16-2012, 05:35 PM #4
Member
- Join Date
- Sep 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Help with KeyListener
By armyson in forum New To JavaReplies: 1Last Post: 11-25-2011, 12:56 PM -
Help with keylistener?
By Kaizo in forum New To JavaReplies: 4Last Post: 12-11-2010, 12:55 AM -
keyListener not doing anything
By imorio in forum AWT / SwingReplies: 10Last Post: 08-17-2010, 10:46 PM -
KeyListener - Is this what I need?
By dbashby in forum New To JavaReplies: 26Last Post: 04-18-2009, 04:14 PM -
KeyListener Example
By Java Tip in forum SWTReplies: 0Last Post: 07-11-2008, 04:46 PM


3Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks