You have added the JPanel over the JFrame which completely blocks out the underlying container on which you have set the color. You could do this instead: public Gui(String title) { super(title); JPanel...
JFrame in full screen Java
You can use custom component instead of a string message, for example: import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; public class TestDialog { public static void main(String args)...

