Java Program

I need a simple java program using applets and threads.
please send me as soon as possible.
thank you!!

Replies

  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Hi Please avoid using sms text on CE!!!

    I edited your post!
  • sowmyanatarajan
    sowmyanatarajan
    ok sure please send program as soon as possible
  • Kaustubh Katdare
    Kaustubh Katdare
    ..thread moved to CS/IT engineering section. I guess any standard JAVA book will have many JAVA programs with applets and threads. Have you referred to any?
  • sowmyanatarajan
    sowmyanatarajan
    Ya i referred. but i need a combined program using applet and threads.
  • Manish Goyal
    Manish Goyal
    have a look

    If you find difficulty in any part ,feel free to ask

    import java.applet.*;
    import java.awt.*;
    /**/
    public class k extends Applet implements Runnable
    {
        Image img[]=new Image[2],p;
        int x=0,y=0,limit=20,i,width=60,height=60;
        int ext=(limit*limit)+width;
        Thread t,t1;
        public void init()
        {
            img[0]=getImage(getDocumentBase(),"Desert.jpg");
            img[1]=getImage(getDocumentBase(),"Hydrangeas.jpg");
        }
        public void start()
        {
            t=new Thread(this);
            t.start();
        }
    
        public void run()
        {
        try{
            for(i=0;i<2;i++)
            {        x=0;
    
            
            for(int j=0;j<=limit;j++)
            {
                p=img[i];
                t.sleep(50);
                repaint();
                x=x+20;
            }
            limit=limit-1;
            }
    
    
        
            }catch(Exception e){}
    }
    
    
    public void paint(Graphics g)
        {
            if(i==0)
            {
                g.drawImage(p,x,30,width,height,this);
            }
            if(i>=1)
            {
                g.drawImage(p,x,30,width,height,this);
                g.drawImage(img[0],ext,30,width,height,this);
            }
        }
    
    }
    
  • Kaustubh Katdare
    Kaustubh Katdare
    Goyal, please refrain from providing ready-made help. Instead, you may help the members code the program on their own. This can be done by providing tips and information. It's bit of a hard work, but it will help in creating better computer engineers (in small way).
  • Manish Goyal
    Manish Goyal
    Ok sir
    i will take care off this next time

You are reading an archived discussion.

Related Posts

Is RAM Booster software really boosts our RAM??? Please Help me..... VIPUL
Hello friend's, I want some read about ethical hacking and for that i need some books. So if anyone who read some books on ethical hacking please share the name...
What is the alias of the network ?
obliterate (v): to wipe out; to destroy completely obstinate (adj): stubborn; unyielding ominous (adj): threatening
palatable (adj): Pleasant to the taste; agreeable to the feelings The word palate refers both to the roof of the mouth and, more commonly, to the sense of taste. A...