Try to use the recommendations from here
To fire keyboard events, a component must have the keyboard focus.
To make a component get the keyboard focus, follow these steps:
Make sure the component's isFocusable method returns true. This state allows the component to receive the focus. For example, you can enable keyboard focus for a JLabel component by calling the setFocusable(true) method on the label.
Make sure the component requests the focus when appropriate. For custom components, implement a mouse listener that calls the requestFocusInWindow method when the component is clicked.