Question
Make a graphics program that displays a smiley face on the screen. The circle must be yellow. There must be a curve of a smile
Make a graphics program that displays a "smiley face" on the screen. The circle must be yellow. There must be a curve of a smile in the lower part of the face, and two small circles for eyes in the upper part of the face. The "mouth" should be red and the eyes should be blue.
i did this so far but i dont think so its right. can someone plz help?
import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Color; import java.awt.Graphics;
public class Smlyfc{
public static void main(String[] args){ JFrame frame = new JFrame("Example Frame"); frame.setSize(300, 300); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBackground(Color.White); Graphics graphics = panel.getGraphics(); frame.add(panel); graphics.setColor(Color.YELLOW); graphics.fillRect(0, 0, 100, 100); frame.toFront(); }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started