Search this site
Embedded Files
Skip to main content
Skip to navigation
AP CS A
Home
Unit 1: Intro to Computers and Software Engineering
Unit 2: Syntax and Objects
Unit 3: Parameters and Objects
Unit 4: Strings and Arrays
Unit 5: Object Oriented Programming
Student Example
Picture Lab
Part 1
Part II
Part III
Part IV
Part V
Part VI
Part VII
Part VIII
Part IX
Unit 6: Inheritance & POLYMORPHISM
Important Computer Scientists
Unit 7: Searching and Sorting
Elevens
Activity 1: Card Class
Activity 2: Deck Class
Activity 3: Shuffling
Activity 4: Shuffle in the Deck Class
Activity 5: Play Elevens
Activity 6: Elevens Board
Activity 7: Inheritance in Elevens
Activity 8: Implementing Elevens Board
Activity 9: Optional Extra work
Unit 8: Recursion
Unit 9: AP Test Review & Final Project
Animation
3D Printing
Life after AP
Resources
Famous Computer Scientists
Operator Practice
Submitting Files
Helpful Videos!
Research Presentation
AP CS A
Home
Unit 1: Intro to Computers and Software Engineering
Unit 2: Syntax and Objects
Unit 3: Parameters and Objects
Unit 4: Strings and Arrays
Unit 5: Object Oriented Programming
Student Example
Picture Lab
Part 1
Part II
Part III
Part IV
Part V
Part VI
Part VII
Part VIII
Part IX
Unit 6: Inheritance & POLYMORPHISM
Important Computer Scientists
Unit 7: Searching and Sorting
Elevens
Activity 1: Card Class
Activity 2: Deck Class
Activity 3: Shuffling
Activity 4: Shuffle in the Deck Class
Activity 5: Play Elevens
Activity 6: Elevens Board
Activity 7: Inheritance in Elevens
Activity 8: Implementing Elevens Board
Activity 9: Optional Extra work
Unit 8: Recursion
Unit 9: AP Test Review & Final Project
Animation
3D Printing
Life after AP
Resources
Famous Computer Scientists
Operator Practice
Submitting Files
Helpful Videos!
Research Presentation
More
Home
Unit 1: Intro to Computers and Software Engineering
Unit 2: Syntax and Objects
Unit 3: Parameters and Objects
Unit 4: Strings and Arrays
Unit 5: Object Oriented Programming
Student Example
Picture Lab
Part 1
Part II
Part III
Part IV
Part V
Part VI
Part VII
Part VIII
Part IX
Unit 6: Inheritance & POLYMORPHISM
Important Computer Scientists
Unit 7: Searching and Sorting
Elevens
Activity 1: Card Class
Activity 2: Deck Class
Activity 3: Shuffling
Activity 4: Shuffle in the Deck Class
Activity 5: Play Elevens
Activity 6: Elevens Board
Activity 7: Inheritance in Elevens
Activity 8: Implementing Elevens Board
Activity 9: Optional Extra work
Unit 8: Recursion
Unit 9: AP Test Review & Final Project
Animation
3D Printing
Life after AP
Resources
Famous Computer Scientists
Operator Practice
Submitting Files
Helpful Videos!
Research Presentation
Part II
Part 2: Color Chooser
Introduction
.
Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
Part 8
Part 9
Open up Eclipse and go to the Java project that has all the files for this project in it.
Run the main method in ColorChooser.java. (In other words, run the program!)
This window will pop up:
Click the "RGB" tab and play around with the sliders to create different colors.
When you click the 'OK' button, the RGB values for the color you picked will be displayed in the console.
The
Color
class has a
toString
method that displays the class name followed by the RGB values.
This
toString
method is called in the main method.
java.awt.Color[r=139,g=174,b=225
Why does the class name look like that?
java.awt.Color
is the 'full name' of the class
'
java.awt
' is a package
awt
stands for "Abstract Windowing Toolkit"
this contains the original Graphical User Interface (GUI) classes made for Java
you can technically just use "
Color
" as the class name, without the other stuff, as long as you use this import statement:
import java.awt.Color;
Part 2: Questions
Run ColorChooser to answer the following questions. Write down your answers!
How can you make pink?
How can you make yellow?
How can you make purple?
How can you make white?
How can you make dark gray?
How do the RGB values relate to the colors?
Part III -----
Report abuse
Report abuse