40 likes | 232 Vues
Color (1). Turtle class contains a method to change the pen color Note : before using Color class, you should add following line in the top of the source file to import Color class import java.awt.Color;. Color (2). Each color is represented by three primitive colors
E N D
Color (1) Turtle class contains a method to change the pen color Note: before using Color class, you should add following line in the top of the source file to import Color class import java.awt.Color;
Color (2) • Each color is represented by three primitive colors • Red, Green, Blue (RGB color specification) • A color (what you see) changes based on the value of each primitive color • Each color will contain a value between 0~255
Color (4) • In Java, you can create a color object Color c1 = new Color( 50, 255, 100 ); setPenColor( c1 ); Or you can simply write setPenColor( new Color( 50, 255, 100 ) ); Note: Please look at this site http://www.jafar.com/java/csel/index.html