> but my textfield doesn't have focus so what then ?
you needed to read further down the page
JComponent.WHEN_IN_FOCUSED_WINDOW
The component's window either has the focus or contains the component that has the focus. This input map is commonly used for mnemonics or accelerators, which need to be active regardless of where focus is in the window.