I have a JDialog
with t开发者_如何学编程wo 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!
The verb "activate" is ambiguous. But regardless, I suggest you read How to Use Key Bindings.
精彩评论