Create a simple GUI that consists of three sliders - one to control the amount of red, one to control the amount of blue, and one to control the amount of green - such that when one of the sliders is...


Create a simple GUI that consists of three sliders - one to control the amount of red, one to control the amount of blue, and one to control the amount of green - such that when one of the sliders is adjusted the color in the central panel changes accordingly. The GUI should look as follows:



colorViewer.png



The layout of the above consists of a panel with the three sliders placed in the NORTH and a panel showing the color placed in the CENTER of a BorderLayout. To change the color of the panel, you will use


setBackground(new Color(red, green, blue));


where red, green, and blue are values between 0 and 255, retrieved from the respective sliders.



Your solution must use the following classes:



  • App : Create the JFrame and adds the MainPanel.

  • MainPanel : A JPanel that consists of two subpanels, SliderPanel and ColorPanel

  • SliderPanel: A JPanel that contains the three sliders and updates the ColorPanel appropriately

  • ColorPanel: A JPanel that shows the color.


Each class must be in its own Java file.

Mar 28, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here