I tried styling a custom-made Dialog
which allows the user to create a new folder. Until I loaded my custom Look and Feel, everything looked just fine:
Now I tried setting the Look and Feel and the texts of the buttons disappeared.
I set up an SSCCE which demonstrates this behaviour. Please note that the LNF class does nothing except for loading all values from UIManager.getDefaults()
. If this helps, I'm using Debian 8 (jessie) with Gnome 3.18.1 and the global dark theme toggled on.
Why does this happen and how can I fix the disappearing of those button texts?
The values retrieved by UIManager.getDefaults()
do not include the texts for JOptionPane
buttons whose properties are OptionPane.cancelButtonText
and OptionPane.okButtonText
respectively. This causes the buttons to be displayed without any text, causing them to be as small as in the screenshot provided in the question. By setting OptionPane.cancelButtonText
and OptionPane.okButtonText
to the desired values, the JOptionPane
buttons will display the set text. This solution may also apply for the yes/no buttons.