Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exercise 7A Write an application that extends JFrame and that displays a yellow

ID: 3548023 • Letter: E

Question

Exercise 7A

Write an application that extends JFrame and that displays a yellow smiling face on the screen. Save as JSmileFace.java


Part B

Add a JButton to the JSmileFace program so the smile changes to a frown when the user clicks the JButton. Save as JSmileFace2.


This is for Chapter 16 in Java Programming Please if you could use only things learned in Java Programming. I am offering a lot of points for this and they will be awarded as soon as answer is submitted you must do part A & B. Please make that your code works and that there are no problems so that I can award points right away

Explanation / Answer

import java.awt.Color;

import java.awt.Graphics;


import javax.swing.*;



public class JSmileFace extends JFrame

{

public JSmileFace()

{

setTitle("SmileFace");

}


public void paint(Graphics g)

{

super.paint(g);

g.setColor(Color.YELLOW);

g.fillOval(100, 100, 100, 120);

g.setColor(Color.BLACK);

g.drawArc(100, 140, 50, 50, 50, 80);

g.drawArc(145, 140, 50, 50, 50, 80);

g.drawArc(125, 150, 50, 50, 230, 80);

}


public static void main(String[] args)

{

JSmileFace face = new JSmileFace();

face.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

face.setSize(400, 400);

face.setVisible(true);

}


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote