Computer Science II, Lab 08
Tuesday, October 9th
Recall that last semester you worked with Pixels, each of which knew their Color. The Color class includes a three-argument constructor that lets the creator of the Color object define a color based on saturation values of red, green, and blue pigment, respectively. Each argument must be an int between 0 and 255, inclusive.
A ColorWheel is a window with a large, stationary Ball in its center. It has sliders for the red saturation value (left), the green saturation value (top), and the blue saturation value (right). It also has textual "labels" to help the user keep them straight. Each label contains the color represented by the slider and the color's current value.
When the user moves a slider, the saturation value for the associated color changes, the ball changes color in the window, and the color's label displays the value of the slider.
A ColorWheel responds to the public message getColor() by returning its current color as a Color. A ColorWheel also uses this method to compute the new color of the ball in its paint() method.
[Note: While I use the term "Label" above, you are not actually required to use the JLabel class. You may use drawString like Budd does in CannonWorld. Of course, if you prefer, you may use JLabel - probably placed with a scrollbar inside of a JPanel and then using BorderLayout to place the Panel. drawString() is probably easier, but not as pretty. JPanel is probably more complicated, but gives you cleaner results (perhaps).]
Test this class using a simple demo application class before proceeding to the next task.
NOTE:
When a Java application displays more than one window, some systems show the windows in the same location on the screen. You can handle this situation in at least two ways:I prefer that you use the second approach.
Using the homework submission system, upload:
Be sure that your submission follows all homework submission requirements.