Java 如何为JFrame设置颜色
粉红色不行Java 如何为JFrame设置颜色,java,swing,jframe,background-color,Java,Swing,Jframe,Background Color,粉红色不行 //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.
//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);
粉红色和其他颜色