问题描述
粉色不行!
//Frame
JFrame f = new JFrame("Tab");
f.setBounds(100,100,1000,1000);
f.setVisible(true);
f.setLayout(null);
f.setBackground(Color.pink);
解决方法
您需要改用内容面板。直接替换
f.getContentPane().setBackground(Color.pink);
代替
f.setBackground(Color.pink);