Set filechooser Colors with Nimbus L&F

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.


I had identical problem, concerning changing background color of JFileChooser.

My solution - new Painter. I guess it will be useful for your purpose too. Constants.APP_BACKGROUND_COLOR is a desired background color. And here is a code sample:

UIManager.getLookAndFeelDefaults().put("FileChooser.background", Constants.APP_BACKGROUND_COLOR);

                    new Painter<JFileChooser>()
                        public void paint(Graphics2D g, JFileChooser object, int width, int height)


Need Your Help

JAVA - path issue (works in eclipse, not in cmd)


Why the following iniciation works in eclipse:

Checkbox binding in GridView using silverlight MVVM

silverlight mvvm

There is a GridView which has multiple rows , what i want is, User can select multiple checkboxes and at

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.