Question: For Java. 1. Create a Smiley class The class needs to extend JPanel The constructor for this class should have 4 parameters. Each parameter should
For Java.
1. Create a Smiley class
The class needs to extend JPanel
The constructor for this class should have 4 parameters. Each parameter should
be a color. One for the outline, one for the skin, one for the smile and one for
the eyes.
Use the paintComponent method to draw the smiley using the colors from the
constructor
i. The smiley must be drawn .
This is the outline of my code right now but I need help organizing this to the requirements above. It can be any color for the parameters . I just need help and know what you did to make this work
import java.awt.*; import javax.swing.*;
public class Smiley extends JPanel { // Smiley constructor takes parameters for 4 colors that will be used to draw the smiley public Smiley(Color outline, Color face, Color smile, Color eyes) {
} // method to draw the smiley face on the panel public void paintComponent(Graphics g) { super.paintComponent(g); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
