Question: in java run through Eclipse Stage 4: (4 points) Toggle Rainbow Mode Button In this stage you are to create another button Toggle Rainbow Mode
in java run through Eclipse Stage 4: (4 points) Toggle Rainbow Mode Button In this stage you are to create another button Toggle Rainbow Mode which, when pressed, changes the behavior of the program and also the preview dot. There are two modes (Normal Mode and Rainbow Mode) and by default the program should start in Normal Mode. In Normal Mode, everything functions as previously described. If your program is in Normal Mode when the Toggle Rainbow Mode button is clicked, then your program must switch to Rainbow Mode. If it is in Rainbow Mode when the Toggle Rainbow Mode button is clicked, then your program must switch back into Normal Mode. The Rainbow Mode changes the programs behavior so that: Instead of drawing a white dot when the mouse is pressed or dragged, a random color is used instead. To create a random color, you will want to use either the class Random (java.util.Random) or the Math.random() method to get random numbers. You will need to select numbers between 0 and 255 for the red, green, and blue component of a color. You can create a new Color ( java.awt.Color ) using these numbers. As a result of Stage 4, when a user drags the mouse (or repeatedly clicks), a series of random colored dots should appear on the screen. In addition, to show that program is in Rainbow Mode the preview dot should be red instead of being white. In addition, a green and blue preview dot should appear 10 and 20 pixels lower, respectively. They should be drawn such that they match the screen shot for stage 4 below. If the user switches back into Normal Mode, your program must redraw the preview dot using the white color.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
