KeyEvents and GLCanvas

Hi all,

I have tryed to write a keyboard cache for a better controll for a camera. But I found somthing confusing. If I debug keyTyped, keyPressed and keyReleased from KeyListener, I get this output:

edit: I add the Listener to the GLCanvas

I press the “a” key
“a” pressed
“a” typed
“a” pressed
“a” typed

and release it
“a” released

It doesn’ t matter if the Animator is running or not. I thought before that key typed is system based and key pressed and released is the real state of the keyboard???.

michael bien

Its not totally expected, but i think thats what counts for ‘normal’ behaviour on linux systems. You simply need to use pressed & released to toggle a set of states and then you’re set (which you’ll need to do anyway to avoid multithreading weirdness).