Make a java program of Mickey I have the starter program but I need to add...

80.2K

Verified Solution

Question

Programming

Make a java program of Mickey I have the starter program but Ineed to add eyes and a smile to it.

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.JFrame;

public class Mickey extends Canvas {

public static void main(String[] args) {
JFrame frame = new JFrame(\"Mickey Mouse\");
Canvas canvas = new Mickey();
canvas.setSize(400, 400);
canvas.setBackground(Color.white);
frame.add(canvas);
frame.pack();
frame.setVisible(true);
}

public void paint(Graphics g) {
Rectangle bb = new Rectangle(100, 100, 200, 200);
mickey(g, bb);
}

public void boxOval(Graphics g, Rectangle bb) {
g.fillOval(bb.x, bb.y, bb.width, bb.height);
g.drawArc(130, 180, 50, 20, 180, 180);
}

public void mickey(Graphics g, Rectangle bb) {
boxOval(g, bb);

int dx = bb.width / 2;
int dy = bb.height / 2;
Rectangle half = new Rectangle(bb.x, bb.y, dx, dy);

half.translate(-dx / 2, -dy / 2);
boxOval(g, half);

half.translate(dx * 2, 0);
boxOval(g, half);
}

}

Answer & Explanation Solved by verified expert
3.9 Ratings (592 Votes)
As per the problem statement I have solve the problem Please letme know if you have any doubts or you want me to modify the answerAnd if you find this answer useful then dont forget to rate myanswer as thumps up Thank you Mickeyjavaimport javaawtColorimport javaawtDimensionimport javaawtGraphicsimport javaxswingJComponentimport javaxswingJFrameClass Mickeypublic class    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students