In nimbus look and feel these all codes are not usable.
So solution is,
UIManager.put("control", new Color(0, 0, 0));
This is also call "Dark Nimbus" add this top of your main frame's main method.
So it will automatically change All JOptionPane's background.
And also you can't change button background with
UIManager.put("OptionPane.buttonBackground", BLACK);
So you should use,
UIManager.put("nimbusBase", new Color(0, 0, 0));
Remember - but unfortunately, this code will change all your buttons etcs' background. So you have to add *.setBackground(...);
to all other objects.
If you want to change foreground of JOptionPane you should use
UIManager.put("text", new Color(255, 255, 255));
Again unfortunately this will change your all of text's foreground.
These all codes are called Dark Nimbus.
If you're using nimbus you can try these UIManager codes to customize nimbus look and feel.
UIManager.put("control", new Color(0, 0, 0));
UIManager.put("info", new Color(0, 0, 0));
UIManager.put("nimbusBase", new Color(0, 0, 0));
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
UIManager.put("nimbusDisabledText", new Color(255, 255, 255));
UIManager.put("nimbusFocus", new Color(115, 164, 209));
UIManager.put("nimbusGreen", new Color(176, 179, 50));
UIManager.put("nimbusInfoBlue", new Color(66, 139, 221));
UIManager.put("nimbusLightBackground", new Color(0, 0, 0));
UIManager.put("nimbusOrange", new Color(191, 98, 4));
UIManager.put("nimbusRed", new Color(169, 46, 34));
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
UIManager.put("nimbusSelectionBackground", new Color(18, 134, 175));
UIManager.put("text", new Color(255, 255, 255));
You can try these codes. In my project the nimbus seem as
But I always recommend using "Flatleaf" (Search google "FlatLafLookAndFeel" or go to jar.download.com"). It is a professional and you can change all to your own.