MediaTracker

20MB of webspace and email for FREE!

This banner was supplied by SAFE Audit


The html file should have the applet tag for the class file

a1.html

<applet code="zzz" width=350 height=250></applet>


The import statements for the all programs will be

import java.applet.*;
import java.awt.*;
import java.awt.image.*;

zzz.java
public class zzz extends Applet
{       Image b;
        public void init()
        {       b=getImage(getDocumentBase(), "borderex1.gif");
        }
        public void paint(Graphics g)
        {       g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet
{       MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(), "borderex1.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e)
                {       return;
                }
        }
        public void paint(Graphics g)
        {       g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet implements Runnable
{       Thread a;
        MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(), "borderex1.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e) {return;}
                a=new Thread(this);
                a.start();
        }
        public void run()
        {       while (true)
                {       try Thread.sleep(100);
                        catch (InterruptedException e)
                        {       break;
                        }
                        repaint();
                }
        }
        public void paint(Graphics g)
        {       g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet implements Runnable
{       Thread a;
        MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(), "borderex1.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e) {return;}
                a=new Thread(this);
                a.start();
        }
        public void run()
        {       while (true)
                {       try Thread.sleep(100);
                        catch (InterruptedException e)
                        {       break;
                        }
                        repaint();
                }
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet
{       MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(), "borderex1.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e)
                {       return;
                }
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       if ((t.statusID(0,false) & MediaTracker.COMPLETE) != 0) 
                        g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet
{       MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(),"borderex1.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e)
                {       return;
                }
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       if ((t.statusID(1,true) & MediaTracker.COMPLETE) != 0) 
                        g.drawImage(b, 0, 0, this);
                else
                        showStatus("Status is false");
        }
}
zzz.java
public class zzz extends Applet
{       Image b;
        public void init()
        {       b=getImage(getDocumentBase(), "borderex0.gif");
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       showStatus("hi");
                g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet
{       MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(),"borderex0.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e)
                {       return;
                }
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       if ((t.statusID(0,true) & MediaTracker.COMPLETE) != 0) 
                        g.drawImage(b, 0, 0, this);
                else
                        showStatus("Status is false");
        }
}
zzz.java
public class zzz extends Applet
{       MediaTracker t;
        Image b;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(), "borderex0.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e)
                {       return;
                }
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       if (MediaTracker.ERRORED == 4)
                        showStatus("error");
                if ((t.statusID(0,true) & MediaTracker.COMPLETE) != 0)
                        g.drawImage(b, 0, 0, this);
        }
}
zzz.java
public class zzz extends Applet
{       MediaTracker t;
        Image b,b1;
        ImageProducer p;
        public void init()
        {       t=new MediaTracker(this);
                b=getImage(getDocumentBase(), "borderex0.gif");
                t.addImage(b,0);
                try t.waitForID(0);
                catch (InterruptedException e)
                {       return;
                }
        }
        public void update(Graphics g)
        {       paint(g);
        }
        public void paint(Graphics g)
        {       if ( t.isErrorAny() )
                        showStatus("is error any");
                if ((t.statusID(0,true) & MediaTracker.COMPLETE) != 0)
                        g.drawImage(b, 0, 0, this);
        }
}

Make your own free website on Tripod.com