Archived

This topic is now archived and is closed to further replies.

[java] Does KeyEvent have any limits(number of keys pressed)?

This topic is 5742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have problems(jdk1.3) because my KeyEvents seem to be queueing up if I press too many keys simultaneously. I have a car game with 4 keys/player and using it for 2 player head-to-head game. The problem is that when 3-4 keys are pressed down simultaneously the keyEvent doesn''t respond to any more "keypressed" event until one of the 3-4 keys are released. The problem also extends to pressing keys that are not used in the game! Any combination of maneuvering(like braking and turning at the same time*2 players) works but not when too many keys are pressed. What is the reason for this problem?

Share this post


Link to post
Share on other sites
It is probably the physical wiring of your keyboard. To save money, there are often limitations as to how many keys can be detected at one time. What you can do is spread out the keys being used, since keys close to each other are on the same bit of circuit. Apart from that, you basically have to comprimise - see if a player can use the mouse or a joystick or something like that.

Just in case it is your programming which is causing it (which I doubt), in a textbox somewhere hold down different keys and see where the conflicts are:

hhhhhhhhhhjjjjjjjjj - k didn''t work on this keyboard
bbbbbbbbbbnnnnnnnn - m didn''t work on this keyboard
aaasssssdddddddddddddddddddddddfffffffffffffffffffff - g didn''t work
qqqqwwweerrrrr - t didn''t work

Also, with some computers (like mine), the little annoying speaker in the computer will click when this happens.

Trying is the first step towards failure.

Share this post


Link to post
Share on other sites