{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HappyWild - canvas.fillOval(230 100 10 20...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.Color; import java.awt.Graphics; import java.util.Scanner; import javax.swing.JApplet; public class HappyWild extends JApplet { public void init() { setSize(500, 500); } public void paint( Graphics canvas ) { System.out.print("Are you happy? (1/0)"); int n1; Scanner keyboard = new Scanner (System.in); n1 = keyboard.nextInt(); System.out.println("n1="+n1); if (n1 == 1) { setSize(400, 400); canvas.setColor(Color.RED); canvas.drawOval(100, 50, 200, 200); canvas.fillOval(155, 100, 10, 20); canvas.fillOval(230, 100, 10, 20); canvas.drawArc(150, 160, 100, 50, 180, 180); } else { setSize(400, 400); canvas.setColor(Color.BLACK); canvas.drawOval(100, 50, 200, 200); canvas.fillOval(155, 100, 10, 20);
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: canvas.fillOval(230, 100, 10, 20); canvas.drawArc(150, 200, 100, 50, 400, 100); canvas.fillArc(65, 60, 80, 120, 50, 220); canvas.fillArc(260, 70, 80, 120, 260, 225); canvas.fillOval(180,150,30,30); canvas.setColor(Color.RED); canvas.fillOval(230, 50, 10, 35); canvas.fillOval(250, 50, 10, 35); canvas.fillOval(225, 70, 40, 10); canvas.fillOval(225, 55, 40, 10); canvas.fillRect(185, 310, 10, 30); canvas.fillRect(205, 310, 10, 30); canvas.fillRect(155, 270, 30, 10); canvas.fillRect(215, 270, 30, 10); canvas.setColor(Color.PINK); canvas.fillArc(85, 90, 30, 60, 50, 220); canvas.fillArc(287, 100, 30, 60, 260, 220); canvas.fillRect(185, 250, 30, 60); } } }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern