Reputation: 4305
I have a JDialog
with two buttons: an OK button and a Cancel button.
I would like the Cancel button to be activated by pressing Esc and an OK to be activated by pressing Return. Can someone give me some suggestions for implementing this feature? Thanks!
Upvotes: 3
Views: 1038
Reputation: 44240
The verb "activate" is ambiguous. But regardless, I suggest you read How to Use Key Bindings.
Upvotes: 4