4. Mod 1. Modify the constructor for the main class in this program: • Within this constructor, add a call to the constructor of the parent class (the JFrame class) passing the string "Histogram Demonstration" as parameter. This will cause the string to be displayed in the window's title bar. This call to the parent constructor must be the first statement in the current constructor. The new additional statement consists of: super(“Histogram Demonstration”); • Modify the text of the TitledBorder that is used for the top JPanel. Add text to the title that informs the user as to: i. The maximum number of data numbers that can be entered. Currently, the maximum number of data values is set at 50. You should not change this. ii. The maximum value that can be entered for each data number. Use the width of histogram rectangular area, which is 300, as the maximum value that can be entered for any data value. When you do this step, use appropriate variables in your code; do not use literals in the statements that specify the text of the TitledBorder. • Add a call to the createColorList method described in Step 6, Mod 3, below. 5. Mod 2. Write a method named createColorList. 1. This method must create an array, named color, consisting of six different colors to be used to display the histogram bars in different colors. Be sure to create pleasing colors. 2. Note that the color array is already declared as a member variable of the main class. 3. Use a constructor from the Color class to create each color. Do not use the predefined colors in the Color class. 4. This method does not need a loop. You can simply assign a Color object to each array cell. For example: color[0] = new Color(255, 0, 150); 5. In the constructor mentioned in the above Mod, add a call to the createColorList method. 6. Mod 3. You can eliminate the use of the JOptionPane dialog. 1. • You can eliminate the JOptionPane dialog since the data numbers will be displayed on the histogram along with each corresponding histogram bar. Mod 4. Make the histogram fit within a fixed display area. 1. Implement the program so that it displays the histogram within a square area that has a fixed size of 300 x 300 pixels. The variables histogramWidth and histogramHeight are already declared in the main class. 2. The histogram must be limited to this display area regardless of the number of data numbers entered for display. In general, the more data numbers that are entered by the user, the thinner the histogram bars will be (so as to fit within the fixed area). This is not the ideal approach, of course; see Extra Credit part B. 3. The next Mod below provides details on the histogram display code. 8. Mod 5. Write the paintComponent method in the MyPanel class. The paintComponent method must do the following: 1. Set the background color to white. 1. Declare variables within the paint method to hold items such as: 1. The thickness of the histogram bars. 2. The starting x coordinate and starting y coordinate for display of all the items to be drawn on the panel. 3. Use (30, 70) for the upper left corner of the histogram square display area. 2. Use the above variables as parameters when calling methods such as g. drawString and g.fillRect. Do not use literals as parameters to these methods. 3. Create a font consisting of the Helvetica font face, bold style, and size 24. 4. Create another font, as in the previous step above, but with size 16. 5. Display a heading within the panel consisting of: "Histogram Demonstration". The heading should be displayed using the larger font that you created in the step above. The heading should be displayed starting at the location (30, 40). 6. Below the above heading, display a another line of text consisting of: “The number of data elements is:”, followed on the same line by the count of the data values entered by the user. This second text line should be displayed using the smaller font that you created in the above step. 1. Add a for-loop that draws the horizontal bars of the histogram. The for-loop must do the following in each pass through the loop body. During the i-th pass: 1. Draw the i-th bar of the histogram. That is, draw a filled rectangle whose horizontal width is equal to the i-th number in the array of data numbers entered by the user and whose height is equal to the thickness variable mentioned above. The positioning values (expressions) for each bar must not contain any literals; use the variables instead. 2. The i-th bar (mentioned above) must be displayed in the i-th color in the color array. If the user has entered more than 6 data numbers to be displayed, the colors in the array must be re-used in a “round robin” manner. That is, each time the color list is exhausted, start at the beginning of the list again. This means, for example, that color number 0 is used again for data number 6, color number 1 again for data number 7, color 2 again for data number 8, etc. 3. Draw a black outline (edge) around each histogram bar. 4. The left ends of all the bars must line up vertically; use your start x variable (e.g., with a value of 30) as the position of the left end of each bar. 5. To the right of each bar, print the value of the data number that is represented by the bar's horizontal dimension. Use the smaller font that you created to print these numbers. 6. Make sure that your display of the text and histogram is pleasing and attractive.