Does anyone have experience with creating a JOptionPane
such as the YES_NO_OPTION
dialog and changing the default to "NO" while maintaining the keyboard shortcuts? I used an array of objects to populate the options of {"YES", "NO"}
and then in the JOptionPane.showOptionDialog
parameters I passed in those options. This works in changing the focus of the button, but removes the keyboard shortcuts for the buttons. Is there anyway to maintain the keyboard shortcuts while also changing focus? This is not a question of how to default to "NO" but rather how to maintain the keyboard shortcuts. The question "How to make JOptionPane.showConfirmDialog have No selected by default?" is asking about focus, no one ever answers how to maintain keyboard shortcuts. Here is a snippet of the code...
Object[] options = {"YES", "NO"};
int choice = JOptionPane.showOptionDialog(null, "Please choose yes/no", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]);