import java.awt.*;public class TestPanel extends Frame { public TestPanel(String str) {
super(str);
}
public static void main(String []args){
TestPanel frm=new TestPanel("Frame with Panel");
Panel pnl=new Panel();
frm.setSize(250,150);
frm.setBackground(Color.red);//我换了几种颜色结果发现不出颜色大小写的区别
frm.setLayout(null);
pnl.setSize(100,100);
pnl.setBackground(Color.RED);//问题出现于此
frm.add(pnl);
frm.setVisible(true);
}
}
* The color red. In the default sRGB space.
*/
public final static Color red = new Color(255, 0, 0); /**
* The color red. In the default sRGB space.
* @since 1.4
*/
public final static Color RED = red;
但Java里的大小些还是要注意的