There is a great big section in the
Java Tutorials about Listeners. I don't agree with all of it, but you can find out about different sorts of Listeners.
If you look at ActionListener, you find that listens for an
ActionEvent. That is fired, for example when a button has the focus and is clicked (or space pressed), or the enter key is pressed on a JTextField (I think, not absolutely certain).
I don't know whether you can change that; it would confuse your users if the button responded to, say "ESC" rather than space. Or would you want a button to fire its action when it doesn't have focus? So I think such changes would be undesirable. But you can look for other Listeners, maybe
one like this, which can be programmed for different actions for different keys, and even to respond to shift alt(meta) and ctrl.
I think this discussion would sit better on our GUIs forum, so I shall move it.
And welcome to the Ranch