import javax.swing.*;
import java.awt.*;

public class Smiley extends JPanel {

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

        // Face
        g.setColor(Color.YELLOW);
        g.fillOval(50, 50, 200, 200);

        // Face outline
        g.setColor(Color.BLACK);
        g.drawOval(50, 50, 200, 200);

        // Left eye
        g.fillOval(100, 100, 20, 30);

        // Right eye
        g.fillOval(180, 100, 20, 30);

        // Straight-line nose
        g.drawLine(155, 125, 155, 155);

        // Smile
        g.drawArc(100, 130, 100, 70, 180, 180);
    }

    public static void main(String[] args) {

        JFrame frame = new JFrame("Smiley");

        Smiley smiley = new Smiley();

        frame.add(smiley);
        frame.setSize(350, 350);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}