where to put listeners

im debating over where to put listeners in my gl demo. specifically, im concerned about closing the application. in the demos ive seen, a WindowAdapter is used on the main window… however, i would like to add a KeyListener to my GLEventListener, and use VK_ESCAPE as the trigger to close the window. now, i want the same events to occur as a result of both closing the window, and pressing escape… i am printing out fps info, and later i will add other stuff. i cant put all this in the GLEventListener because i will not have a chance to invoke animator.stop(), so does anyone have any suggestions as to how i can do this? thank you very much, i appreciate your help.

Well there is nothing stopping your GLEventListener from implementing the appropriate listener or extending the relevant adapter and putting your listener code in there. Just be sure to set your GLEventListener as the event listener for the window and it will happily flood you will all the fun key events you desire.

Actually I can’t seem to get this to work. I have tried setting key listeners on the frame and on the canvas, but I can’t get anything to fire.

Any tricks?

… ah I needed to set the canvas to focasable.

that did the trick