Hi everybody!
this applet below runns three time instead of one.
even inserting the mediatracker class did not fix the problem.
who can help?
many thanks for help
peter
import java.awt.*;
import java.applet.*;
public class picturemove extends Applet implements Runnable
{
Image bild;
String dateiname;
public void init()
{
dateiname="sarajevo1.gif";
MediaTracker mt = new MediaTracker(this);
bild=getImage(getCodeBase(),dateiname);
mt.addImage(bild,0);
try
{
mt.waitForAll();
}
catch (Exception e) {};
}
public void run()
{
repaint();
}
public void paint(Graphics g)
{
int x;
int h=(size().height/2)-35;
int b=(size().width/2)-35;
for (x=size().height; x>=b ;x--)
g.drawImage(bild,b,x,this);
try
{
Thread.sleep(50);
}
catch(Exception e){}
if(x!=h)
g.clearRect(0,0,size().width,size().height);
}
}