第7节 Color 类
10.7 Color 类
Java中有关颜色的类是Color类,它在java.awt包中,这个类声明了用于操作Java程序中颜色的方法和常量

Color 类
Color c = new Color(r, g, b);
r,g,b 指定一个颜色的红、绿、蓝成分
例如:
Color c = new Color(128, 100, 100);
设置颜色
使用下面的方法设置组件背景色和前景色:
setBackground(Color c)
setForeground(Color c)
例如:
setBackground(Color.yellow);
setForeground(Color.red);


