フレームがコンテンツ ペインの上に配置されている場合、ユーザーに対する外部の色は JFrame の色です。ここでも、コンテンツ ペインの後にフレームをペイントしていますが、コンテンツ ペインの色が表示されます。なんで?
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);
}
}