Question: Write a program that displays a disk and three sliders. A JSlider object is a component that lets the user graphically select a value by
Write a program that displays a disk and three sliders. A JSlider object is a component that lets the user graphically select a value by sliding a knob within a bounded interval. Each slider in the GUI is labeled with a color name in a JLabel object: red, green, and blue. Each slider varies between min=0 and max=255. Together, the three sliders provide the RGB numbers necessary to create a Color object. When the user changes a slider, the disk's RGB color must change accordingly.
Use the MVC architecture and the Observer pattern. Register with each slider a ChangeListener object (Controller). When the user moves a slider, the ChangeListener object notifies the model of the change. The model gets the updated numbers from the 3 sliders and notifies the view. The view object can be a JComponent subclass that displays the disk in function paintComponent().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
