The Photographe 0 Newbie Poster

I am having some problems with (a)coloring my stick figer(b)to stabelise the line on which the stick fig is supposed to be running across the Applet on. Can some one please advise me on how to achive this? Thanking you in advance.

//Walking
//Written By:
//Written on:
   import java.applet.*;
   import java.awt.*;
   import java.awt.event.*;
    public class Walking extends Applet
   {
      private int count = 0;
      private int sleep = 100;
      private int startx = 45,oldx = 42;
       public void start()
      {
         count = 0;
         startx = 35;//starting point
      }
       public void paint(Graphics gr)
        
      {
         if((count%2)==0)
         {
            // ? gr.setBodyColor(Color.RED);?//
            gr.setColor(getBackground());
            gr.drawOval(oldx - 15,30,45,45); 
            gr.drawLine(oldx,75,oldx,110); 
            gr.drawLine(oldx,160,oldx+5,160);
            gr.drawLine(oldx+5,110,oldx+10, 155); 
            gr.drawLine(oldx+10,155,oldx+20, 155); 
            gr.drawLine(oldx,110,oldx+20,140); 
            gr.drawLine(oldx+20,140,oldx+30,140);
            gr.setColor(getForeground());
            gr.drawOval(startx - 15,30,45,45); 
            gr.drawLine(startx,75,startx,110); 
            gr.drawLine(startx,110,startx,160);
            gr.drawLine(startx,160,startx+5,160);
            gr.drawLine(startx+5,110,startx+10,155);
            gr.drawLine(startx+ 10,155,startx + 20,155);
            gr.drawLine (startx +5,165,startx + 280,150);//Line
              //on which the fig is walking 
         }
         else
         {
            gr.setColor(getForeground());
            gr.drawLine(startx,110,startx+20,140);
            gr.drawLine(startx+20,140,startx+30,140); 
            gr.setColor(getBackground());
            gr.drawLine(startx+5,110,startx+10, 155);
            gr.drawLine(startx+10,155,startx+20, 155);
            oldx = startx;
            startx +=3;
         }
         ++count;
         if(startx>400 ) //Distance walking across the Applet
         
            startx = 35;//RE-starting point
         try
         {
            Thread.sleep(sleep);
         }
             catch(InterruptedException e)
            {
               showStatus(e.toString());
            }
         repaint();
      }
   }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.