Java JOptionPane.showConfirmDialog热键 [英] Java JOptionPane.showConfirmDialog hot key
问题描述
我正在使用JOptionPane.showConfirmDialog在Java中显示一个确认对话框.该对话框向用户显示是"否确认.这称为:
I am displaying a confirmation dialog in Java using JOptionPane.showConfirmDialog. The dialog shows a Yes No confirmation to the user. This is called as follows:
int result = JOptionPane.showConfirmDialog(sessionObjects.getActiveComponent(),
"Are you sure you want to exit?", "My App", JOptionPane.YES_NO_OPTION);
问题是,这是一个简单的确认,用户可以按 y 表示是,而按 n 表示否吗?目前,用户必须单击按钮吗?
The question is as this is a simple confirmation, can the user press y for yes and n for no? At present the user has to click on the buttons?
谢谢
安德兹(Andez)
推荐答案
对于按钮,您已经具有热键"(助记符):对于"Yes",已使用 Alt + Y "和 Alt + N 表示否".
You already have "hotkeys" (mnemonics) for the buttons: Alt+Y for "Yes" and Alt+N for "No".
您还可以点击 Tab 在它们之间切换,并按下 Space 按下.
You can also hit Tab to toggle between them and Space to press.
这篇关于Java JOptionPane.showConfirmDialog热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!