Results 1 to 2 of 2
  1. #1
    Angry@Java is offline Member
    Join Date
    May 2011
    Rep Power

    Question Snowman Applet - SWING

    I need help with the below code. It is an Applet and needs to be changed to SWING. I am currently in CIS140 and have taken CIS106, semesters ago, and forgot a lot of material. Of course right when I learn applets he changes it to learning about swing. Its a 7-week class and its hard to learn all the material in that amount of time. I got a C in the 15-week class and probably am getting below a C in this class; so any help would be GREATLY appreciated....


    import java.applet.Applet;
    import java.awt.*;

    public class Snowman extends Applet
    //draws a snowman

    public void paint (Graphics page)
    final int MID = 150;
    final int TOP = 50;

    setBackground (Color.cyan);

    page.setColor (;
    page.fillRect (0, 175, 300, 50 ); //ground

    page.setColor (Color.yellow);
    page.fillOval (-40, -40, 80, 80); //sun

    page.setColor (Color.white);
    page.fillOval(MID-20, TOP, 40, 40); //head
    page.fillOval (MID-35, TOP+35, 70, 50); //upper torso
    page.fillOval (MID-50, TOP+80, 100, 60); //lower torso

    page.setColor (;
    page.fillOval (MID-10, TOP+10, 5, 5); //left eye
    page.fillOval (MID+5, TOP+10, 5, 5); //right eye

    page.drawArc (MID-10, TOP+20, 20, 10, 180, 140); //smile

    page.drawLine (MID-25, TOP+60, MID-50, TOP+40); //left arm
    page.drawLine (MID+25, TOP+60, MID+55, TOP+60); //Right arm

    page.drawLine (MID-20, TOP+5, MID+20, TOP+5); //brim of hat
    page.fillRect (MID-15, TOP-20, 30, 25); //top of hat
    }//end paint
    }//end class

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

Similar Threads

  1. Moving snowman
    By Star in forum AWT / Swing
    Replies: 0
    Last Post: 04-09-2011, 08:27 PM
  2. Change Applet to Swing
    By aryowap in forum AWT / Swing
    Replies: 4
    Last Post: 07-08-2010, 09:03 PM
  3. starting a Swing application from an applet
    By FakeRabbit in forum Java Applets
    Replies: 9
    Last Post: 09-21-2008, 07:00 PM
  4. Create Windows, Applet & Swing
    By Eric in forum AWT / Swing
    Replies: 1
    Last Post: 07-05-2007, 06:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts