JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Snowman for real Posted by marcusR on 13 Jul 2005 at 10:05 AM
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 (Color.green);
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 (Color.black);
page.fillOval (MID-10, TOP+10, 5, 5); // left eye
page.fillOval (MID+5, TOP+10, 5, 5); // right eye
page.drawArc (MID-13, TOP+8, 10, 10, -190, -160); //left eye brow
page.drawArc (MID+2, TOP+8, 10, 10, -190, -160); // right eye brow

page.drawArc (MID-10, TOP+20, 20, 10, 190, 160); // 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
page.fillOval (MID-4, TOP+50, 8, 8); // top button
page.fillOval (MID-4, TOP+80, 8, 8); // middle button
page.fillOval (MID-4, TOP+110, 8, 8); // bottom button

page.setColor (Color.orange);
page.fillOval(MID-2, TOP+14, 4 ,4); //nose part 1
page.fillOval(MID-2, TOP+16, 3 ,3); //nose part 2
page.fillOval(MID-2, TOP+18, 2 ,2); //nose part 3
}
}
// reply with any comments or critisisums
Report
Re: Snowman for real Posted by zibadian on 14 Jul 2005 at 5:37 AM
: 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 (Color.green);
: 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 (Color.black);
: page.fillOval (MID-10, TOP+10, 5, 5); // left eye
: page.fillOval (MID+5, TOP+10, 5, 5); // right eye
: page.drawArc (MID-13, TOP+8, 10, 10, -190, -160); //left eye brow
: page.drawArc (MID+2, TOP+8, 10, 10, -190, -160); // right eye brow
:
: page.drawArc (MID-10, TOP+20, 20, 10, 190, 160); // 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
: page.fillOval (MID-4, TOP+50, 8, 8); // top button
: page.fillOval (MID-4, TOP+80, 8, 8); // middle button
: page.fillOval (MID-4, TOP+110, 8, 8); // bottom button
:
: page.setColor (Color.orange);
: page.fillOval(MID-2, TOP+14, 4 ,4); //nose part 1
: page.fillOval(MID-2, TOP+16, 3 ,3); //nose part 2
: page.fillOval(MID-2, TOP+18, 2 ,2); //nose part 3
: }
: }
: // reply with any comments or critisisums
:
You can delete and edit your own messages as long as there are no replies to it. Just read the message and click the correct link.
Report
not JavaScript and not how to submit code Posted by Josh Code on 17 Jul 2005 at 10:38 AM
If you want to submit code, there are other ways.

Submit content -> Manual submission -> Submit new resource -> Submit new file or product

Also, this is Java and not JavaScript. If you had a question, there is another messageboard for it.



: 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 (Color.green);
: 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 (Color.black);
: page.fillOval (MID-10, TOP+10, 5, 5); // left eye
: page.fillOval (MID+5, TOP+10, 5, 5); // right eye
: page.drawArc (MID-13, TOP+8, 10, 10, -190, -160); //left eye brow
: page.drawArc (MID+2, TOP+8, 10, 10, -190, -160); // right eye brow
:
: page.drawArc (MID-10, TOP+20, 20, 10, 190, 160); // 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
: page.fillOval (MID-4, TOP+50, 8, 8); // top button
: page.fillOval (MID-4, TOP+80, 8, 8); // middle button
: page.fillOval (MID-4, TOP+110, 8, 8); // bottom button
:
: page.setColor (Color.orange);
: page.fillOval(MID-2, TOP+14, 4 ,4); //nose part 1
: page.fillOval(MID-2, TOP+16, 3 ,3); //nose part 2
: page.fillOval(MID-2, TOP+18, 2 ,2); //nose part 3
: }
: }
: // reply with any comments or critisisums
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.