-
Snowman Applet
Alright, I'm having trouble on putting text in my applet. It says I need to put my name in the upper-left corner. I have managed to get a frowny face, shift it 20 pixels to the right, put 2 red buttons in the upper torso, and I also got the sun in the upper right corner. Now how do I get my name in the upper left corner? Any advice?
Here is my code...
Code:
package applet;
import java.applet.Applet;
import java.awt.*;
public class Snowman extends Applet
{
public void paint (Graphics page)
{
final int MID = 150;
final int TOP = 50;
setBackground (Color.cyan);
page.setColor (Color.blue);
page.fillRect (0, 175, 300, 50); //ground
page.setColor (Color.yellow);
page.fillOval(300, -40, 80, 80); //sun
page.setColor (Color.white);
page.fillOval (MID-0, TOP, 40, 40);
page.fillOval (MID-15, TOP+35, 70, 50);
page.fillOval(MID-30, TOP+80, 100, 60);
page.setColor (Color.red);
page.fillOval (MID+14, TOP+42, 10, 10);
page.fillOval (MID+14, TOP+60, 10, 10);
page.setColor (Color.black);
page.fillOval (MID+10, TOP+10, 5, 5);
page.fillOval (MID+25, TOP+10, 5, 5);
page.drawArc (MID+10, TOP+25, 20, 10, 10, 160);
page.drawLine (MID-5, TOP+60, MID-30, TOP+40);
page.drawLine (MID+45, TOP+60, MID+75, TOP+60 );
page.drawLine (MID+0, TOP+5, MID+40, TOP+5);
page.fillRect (MID+5, TOP-20, 30, 25);
}
}
-
Re: Snowman Applet
Have you read the API for Graphics?
db
-
Re: Snowman Applet
I see that I have to use drawChars, but where do I put that? It says I need to make a public void statement, so do I put that in my main class?
-
Re: Snowman Applet
-
Re: Snowman Applet
Nevermind I got it...tnx!!!