Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author illcod
- */
- import java.awt.*;
- import java.applet.*;
- public class Snowman extends Applet {
- public void paint (Graphics g) {
- final int MID = 150;
- final int TOP = 50;
- setBackground(Color.cyan);
- // fill a blue rectangle on the screen to make the ground
- g.setColor(Color.blue);
- g.fillRect(0,175,300,50);
- // fill a yellow oval (circle) in the sky to make the sun
- g.setColor(Color.yellow);
- g.fillOval(-40,-40,80,80);
- // fill in the snowman parts
- g.setColor(Color.white);
- g.fillOval(MID-20,TOP,40,40); //head
- g.fillOval(MID-35,TOP+35,70,50); //upper torso
- g.fillOval(MID-50,TOP+80,100,60); //lower torso
- // buttons on front
- g.setColor(Color.black);
- g.fillOval(MID-3,TOP+50,5,5);
- g.fillOval(MID-3,TOP+60,5,5);
- g.fillOval(MID-3,TOP+70,5,5);
- //draw the eyes
- g.setColor(Color.black);
- g.fillOval(MID-10,TOP+10,5,5);
- g.fillOval(MID+5,TOP+10,5,5);
- g.drawArc (MID-10,TOP+20,20,10,190,160); //smile
- g.drawLine (MID-25,TOP+60,MID-60,TOP+40); //left arm
- g.drawLine (MID+25,TOP+60,MID+55,TOP+60); //right arm
- g.setColor(Color.GRAY);
- g.drawLine(MID-20,TOP+5,MID+20,TOP+5); //brim of hat
- g.fillRect(MID-15,TOP-20,30,25); //top of hat
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement