what is color in awtcolor is a class in the awt


What is Color in AWT?

Color is a class in the AWT. Individual colors such as red or mauve are examples of this class, java.awt.Color. Be sure to import it if you want to use other than the default colors. You form new colors using the same RGB triples in which you use to set background colors on web pages. Therefore you use decimal numbers instead of the hex values used through HTML's bgcolor attribute. For instance medium gray is Color(127, 127, 127). Pure white is Color(255, 255, 255). Pure red is (255, 0, 0) and so on. As with any variable you should provide your colors descriptive names. For instance

Color medGray = new Color(127, 127, 127);
Color cream = new Color(255, 231, 187);
Color lightGreen = new Color(0, 55, 0);

A few of the most common colors are available by name. These are

• Color.black
• Color.blue
• Color.cyan
• Color.darkGray
• Color.gray
• Color.green
• Color.lightGray
• Color.magenta
• Color.orange
• Color.pink
• Color.red
• Color.white
• Color.yellow

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: what is color in awtcolor is a class in the awt
Reference No:- TGS0285264

Expected delivery within 24 Hours