Java Swing - Pressed key gets not released (sometimes)?

May be would be better look at KeyBindings that's easily to build Listener for key actions as KeyListener.

May be would be better look at KeyBindings, that's easily to build Listener for key actions as KeyListener.

Similar questions were asked several times, take a look at how-to-know-when-a-user-has-really-released-a-key-in-java or how-to-stop-repeated-keypressed-keyreleased-events-in-swing I hope this helps; edit: what you could do, is using a polling mechanism: static Toolkit kit = Toolkit. GetDefaultToolkit(); .. if (kit. GetLockingKeyState(KeyEvent.

VK_X)) .. this means you always check in your thread if a certain key is pressed. But keep in mind that polling is not efficient.

I am not getting to many released events, I have one lost (or the order in which the events are fired is mixed up). – Julius Eckert Jul 18 at 11:20.

For a game, I use a KeyListener to know when a key is pressed down. This works 99.9%. But from time to time (often enough), the keyReleased is not called, when the key is released (causing the game character to continue moving right - pressing the key again fixes the problem).

Maybe relevant: I use OSX 10.6 and I press down multiple keys at the same time quiet often. How can I make this work 100%?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions