I'm trying to change the background color of a JOptionPane but this code didnt work.
JOptionPane jOptionPane1 = new JOptionPane( );
jOptionPane1.showMessageDialog(this, "Επιτυχής καταχώρηση");
jOptionPane1.setBackground(Color.white);
But why?
(I understand that JOptionPane is a static method and theres no need to create a new object, and that i can just import the UIManager to get the job done.)
This should solve your problem.
JOptionPane op = new JOptionPane("message", JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
op.setOpaque(true);
op.setBackground(Color.BLACK);
op.createDialog(this, "Titel").setVisible(true);
If not, you should have a look on this workaround JOptionPane with different background