2

I am trying to override the Nimbus default color scheme of JFileChooser. I am using the following snippet to do that:

try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            UIDefaults defaults = UIManager.getLookAndFeelDefaults();
            defaults.put("Button.background",  new Color(240,230,140));
            defaults.put("OptionPane.background",Color.white);
            defaults.put("Panel.background",Color.white);
            defaults.put("Frame.background",Color.white);
            defaults.put("FileChooser.background",Color.white);
            break;
        }
    }
} 
catch (Exception e) {
}

This code is just changing the background color of the panels rather than the complete JFileChooser. Also it is not overriding the background color of the okay button. Here is the snapshot of the JFileChooser hence formed:

Screenshot

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
DevX
  • 490
  • 6
  • 23

0 Answers0