Write the class header for my color applet remember to


Problem

Creating an Applet with a Background Color In preparation for creating your own personal Web page, you would like to view some possible background colors that will be easy to read with black text. You decide to write a Java applet that displays black words on a colored background. You will use the setback ground() method, which accepts a color argument in applets.

1. Start Text Pad. Save the file as Java source code with the file name My Color Applet.

2. Type a block header with the information about you and the assignment.

3. Import the java.awt.* and java.applet.* packages.

4. Write the class header for My Color Applet. Remember to extend the Applet class. Include an opening brace for the class.

5. Write a method header for the paint() method. Include an opening brace for the method.

6. Set the background color to yellow.

7. Use the draw String() method to print the words "This is a color test" at the coordinates 25 and 30.

8. Enter closing braces to close the method and class.

9. Compile the program. Fix errors as necessary.

10. On the Text Pad menu bar, click File and then click New. Type the HTML code to reference the MyColor.class with a width of 400 and a height of 200. Be sure to include the start and end tags.

11. Save the HTML document with the filename MyColorApplet. Make sure you specify the HTML (*.htm*,*.stm*) file type.

12. Run the program.

13. Edit the program several times and change the color to red, blue, cyan, and orange. Compile and then run the program after each color change.

Text Book: Java Programming: Comprehensive Concepts and Techniques By Gary B. Shelly, Thomas J. Cashman, Joy L. Starks, Michael Mick.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write the class header for my color applet remember to
Reference No:- TGS02732668

Expected delivery within 24 Hours