Configure mnemonics for non-English yes/no buttons#14533
Conversation
Add mnemonics to begin log file prompt.
| }); | ||
|
|
||
| yes.setPreferredSize(new Dimension(100, yes.getPreferredSize().height)); | ||
| no.setPreferredSize(new Dimension(100, no.getPreferredSize().height)); |
There was a problem hiding this comment.
I suspect this is not right for the preferred width. That should depend on the font size and text length.
Isn't the way to do all of this setting the locale on JOptionPane?
There was a problem hiding this comment.
It seems that when an options array of buttons is provided to JOptionPane the buttons are not formatted in the same way as buttons created internally by JOptionPane. Without resizing the buttons, the custom yes/no buttons appear smaller in width than in the existing dialog. Hard coding the dimension was my brute force attempt to make the buttons appear as before.
The buttons wrap the yes/no text, which is typically short words. Instead of hard coding a dimension, I changed this to double the left/right insets. This seems simpler than dealing with fonts and text lengths.
Isn't the way to do all of this setting the locale on JOptionPane?
I never got JOptionPane.setDefaultLocale() to work with custom buttons (i.e. dialogs that don't use the typical yes/no/cancel text). Where is did work, it didn't work for all supported languages. I don't recall the details as this was some time ago.
This pull request addresses two related issues.
This image shows the before and after appearance of queries in German.
