Computing.Net > Forums > Programming > keypressed problems in java

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

keypressed problems in java

Reply to Message Icon

Name: Neal
Date: January 31, 2009 at 07:28:16 Pacific
OS: Windows Vista
Subcategory: Java
Comment:

Hi,
I have written a game in Java in which the player can move a character using WASD. The problem I am having is that every now and then one of they keys will 'stick'. whenever a keypressed event occurs it is checked againt the control keys and a boolean is set to true if one of them has been pressed, and on a keyreleased event it is set to false. The problem seems worse on slower machines so I think the problem is that it is missing keyreleased events sometimes due to the high number of key events. There are very many because every time the keyboard automatically repeats a key press for the user when they hold a key down it generates a new keypressed event, which floods the key processor.
Does anybody know a way that I can just get it to report the first time a key is pressed to take the strain off the game? Or perhaps something else that may be causing this?
Thanks



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Word highlighting in Visu... batch secript to open My ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: keypressed problems in java

Prime Number problem in java www.computing.net/answers/programming/prime-number-problem-in-java/12949.html

Help with problem in JAVA... www.computing.net/answers/programming/help-with-problem-in-java/5117.html

how to compare 2 files in java www.computing.net/answers/programming/how-to-compare-2-files-in-java/19445.html