130 likes | 138 Views
Learn how to change the colors of objects in Java using predefined and custom colors. Explore syntax for color manipulation and how to create your own colors. Join us for Exam 1 review and hands-on Lab 1. Complete with relevant announcements and schedules for a foundational Java experience.
E N D
CSE 113 A January 26 – 30, 2009
Announcements • 1/30: Last day to turn in signed form from syllabus & Exam 1 review sheet available • 2/4: Go over review sheet for Exam 1 • 2/6: Exam 1 & Lab 1 due • 2/9: Go over Exam 1 • 2/11: Makeup exam for Exam 1
Syntax: Calling methods • objectReference.methodName();
Change Color of Turtle • setColor(java.awt.Color)
Pre-defined Colors • RED • ORANGE • YELLOW • GREEN • BLUE • CYAN • MAGENTA • BLACK • WHITE • GREY
Color Syntax • java.awt.Color.RED
Color Syntax • java.awt.Color.RED • RED – an object that represents the color RED. RED is a pre-defined constant of the class Color.
Color Syntax • java.awt.Color.RED • Colorclass can be used to create (any) color. You can use the pre-defined color constants or create your own color by specifying red, green, and blue values in the range of 0-255. (More on this later.)
Color Syntax • java.awt.Color.RED • The Color class lives in a package named awt. • A package is a way to group like code together.
Color Syntax • java.awt.Color.RED • awt package is a package inside another package named java.