- To hell with the pig... I'm going to Switzerland.

Ignoring Spurious Repeated KeyAdapter Events in Java (Friday, October 9, 2009)

When running in an X11 environment, it appears as though either Java or the windowing system stupidly generate lots of repeated key events when you hold a key down. As it is impractical to get users to reconfigure their systems, and Sun seems unable to fix this issue (having been reported nearly ten years ago). I have written an adapter that is an attempt to filter out the useless events, and released it here as open source software.

Many people have whined about this, but few have fixed it. Some have tried, but their solutions are not as clean as my OCD nature requires. Here are some examples of what this is meant to handle:

The goal is to generate a KeyPressed event when a key is pressed, and to generate a KeyReleased event when a key is released. And ONLY when a key is pressed or released.


—Brian (10/9/2009 9:00 PM)


Version 2.0 is now posted and includes improved queue handling to prevent spinning and minimize latency.

-- Brian (1/4/2011 3:15 PM)

(no html)

Disclaimer: Opinions on this site are those of Brian Ziman and do not necessarily
reflect the views of any other organizations or businesses mentioned.