I'm using custom Colors with Nimbus. After hours of searching I can't find out how to set the Background and Foreground colors for JFileChooser
properly.
My (non working) code:
UIManager.getLookAndFeelDefaults().put("FileChooser.background", Color.DARK_GRAY);
UIManager.getLookAndFeelDefaults().put("FileChooser.textForeground", Color.white);
UIManager.getLookAndFeelDefaults().put("FileChooser.foreground", Color.white);
UIManager.getLookAndFeelDefaults().put("Label.foreground", Color.white);
According to Oracle Nimbus defaults this should work, but doesn't. I also couldn't find the answer anywhere else.
What I want to change
I would like to have the Labels: (Look In:, Folder Name: Files of Type) displayed in white and the light gray borders displayed in dark gray.
Thanks in advance :)
Update: I could fix some Text colors with a detour:
UIManager.getLookAndFeelDefaults().put("textForeground", Color.white);
UIManager.getLookAndFeelDefaults().put("Menu.textForeground", Color.white);
UIManager.getLookAndFeelDefaults().put("ToolTip.textForeground", Color.BLACK);
UIManager.getLookAndFeelDefaults().put("List.textForeground", Color.BLACK);
UIManager.getLookAndFeelDefaults().put("TextField.foreground", Color.BLACK);
UIManager.getLookAndFeelDefaults().put("TextArea.foreground", Color.BLACK);
UIManager.getLookAndFeelDefaults().put("EditorPane.foreground", Color.BLACK);
However, the Frame Background of JFileChooser
still remains Light Gray (while ALL other Frames/Dialogs and MessageDialogs honour the set backround color DarkGray).
Another weird one I now noticed as well is:
The popupmenu respects the background color of JMenuItem
but ignores the foreground.
To illustrate what I mean I uploaded an a new IMAGE where I compare a "normal" popupmenu and one that appears inside JFileChooser
.