Keylisteners require the component to have focus. An alternative would be to use KeyBindings: How to Use Key Bindings (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Other Swing Features)