Original Post
Hi everybody I'm writing an SWT interface for a simple java game I'm designing (basically just an excuse to learn SWT), and I'm having a problem incorporating a listener to register keyboard input. Since I want this listener to have as wide a scope as possible, I'm incorporating it into the shell. My basic code for this is: Listener listener = new Listener() { public void handleEvent(Event e) { // switch statements for key inputs and stuff here } } shell.addListener(SWT.KeyDown, listener); I know this code works in theory, since I created a test program which just initialized a shell and added the listener. Everything worked fine. The problem is that in my real program, as soon as I add any other components which might gain the focus and take it away from the shell, the listener doesn't work. So it looks like a listener can only work if the component it's attached to has the focus. Is there any way to create a listener which could operate regardless of what has the focus? I was hoping adding it to the shell would do it, but apparently that doesn't work. I'd really appreciate any help, this has been frustrating me for a while now. Thanks