开发者

Activating a JButton via keyboard

开发者 https://www.devze.com 2023-04-10 17:41 出处:网络
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 s

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号