Question: Pre-lab Homework Design and implement an application that presents a single button to the user. The driver class should be called TrafficLight. Traffic Light Traffic

Pre-lab Homework Design and implement an application that presents a single button to the user. The driver class should be called TrafficLight. Traffic Light Traffic Light Traffic Light The button will start with background color GREEN and each time it is clicked, it will cycle through YELLOW then RED then back to GREEN Keep track of the current color using an index into an array of possible colors Set the preferred size of you button to 200x200 (or a size of your choice). Hint: If you are on a Mac, you will need to call the following methods on your button to see the background color button.setOpaque (true); button.setBorderPainted (false); Don't forget to add an ActionListener to your button. Your actionPerformed method should change the background color of the button
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
