Question: Make a java program of Mickey I have the starter program but I need to add eyes and a smile to it. import java.awt.Canvas; import

Make a java program of Mickey I have the starter program but I need 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); }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!