If the frame is placing on top of the content pane the exterior colour to the user is colour of JFrame. Here even i'm painting the frame after content pane but content pane colour will be displayed. Why?
public class GUI {
public static void main(String[] args){
JFrame frame = new JFrame();
frame.setSize(300,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
Color myColor = new Color(100,100,100);
frame.setLocationRelativeTo(null);
frame.getContentPane().setBackground(myColor);
frame.setBackground(Color.red);
}
}