In the bowels of the BasicOptionPaneUI
, which is responsible for the appearance of the JOptionPane
, three JPanel
, so you can paint it like this:
// метод put у UIManager - статический, создавать его экземпляр не нужно UIManager.put( "OptionPane.background",new ColorUIResource(59,59,59) ); UIManager.put( "Panel.background",new ColorUIResource(59,59,59) );
If the color of the panels in the entire program cannot be changed, you can save the old value of "Panel.background"
before calling showMessageDialog
and then return it back, or write and register your implementation of BasicOptionPaneUI
.