The next step should be to actually make the scrollbars control the color of the background displayed. That is, for now we won't worry about controlling the text color. Instead, just try to get control over the background.
We will split this task into two parts. First, I want you to fill in some of the body of the method named "drawDisplay". Eventually, this method will draw both the text and background in their desired colors. For now, it will just display the background.
While we are not worrying about drawing the text in the right color at this point, the fact that we will eventually want to do this will affect the way we define "drawDisplay". In the similar applet you wrote for lab 4, a method like "drawDisplay" was defined. The method in lab 4 expected three integer parameters that determined the color to be used for the background. The values of these parameters could be determined directly from the scrollbars using the "getValue" method when needed.
In this applet, "drawDisplay" will need to know two colors each time it is invoked: one for the background and one for the foreground. At any time, the current values of the scrollbars will determine the three numbers that describe one of the colors. The scrollbars, however, can not describe two colors at once. Suppose, for example, that the Choice has been set so that the scrollbars currently control the text color. We could use the "getValue" method to get the numbers needed to determine the text color from the scrollbars. We can't use this approach, unfortunately, to determine the three numbers that describe the background color. Instead, we somehow have to remember the values associated with the three scrollbars the last time they were set to control the background color. We will do this by associating these values with variable names.
You should define three "int" variable names that can be associated with the values that describe the background's color. The "scroll" event handler you write shortly will have to associate these names with the values determined by the scrollbars and the "drawDisplay" method will use them to set drawing colors. These variables will need to be declared outside any method, like the names of the Sliders. That way, they can be accessed directly by "drawDisplay" and you will not need to pass any parameters when you invoke "drawDisplay". Pick appropriate names that indicate both the color represented and the fact that the values associated with the names describe the background color because eventually you will need three more variable names for the text color.
Now, fill in the body of the "drawDisplay" method with a single instruction to fill the background with the color described by the three background color variables.
To test that this method works correctly, add assignment statements to set the three color variables to some values between 0 and 255 (200, 0 and 200 worked well in lab 4) to begin. These assignments belong near the end of "begin", just before the invocation of "drawDisplay" we included at the very end of "begin" Finally, run your applet to test that "showDisplay" works correctly.
Once "showDisplay" is working, it should be fairly easy to make the scrollbars control the background color. When any of the scrollbars is changed using the mouse, the "scroll" event handling method will be invoked by the browser. So, all you need to do is to define a "scroll" method that will make sure the three color variables are associated with the new color values described by the updated scrollbars and then invoke "showDisplay". You can do this by assigning the values returned by invoking the "getValue" methods of the sliders to the three variables you declared for the background color.
Once this is done, you should be able to change the background color when your run your applet.
If it works, this would be a good time to change the initial values you assigned to the three variables for the background color from the values used for testing (probably 200,0,200) to the correct initial values (255,255,255).