I need to make an applet which shows two lines that are at a distance from each other and are moving towards each other and i have to show this until they meet at a point... for this i wrote the following code..
import java.applet.Applet;
import java.awt.*;
public class Drawing extends Applet{
int i;
int x=10;
int x1=50;
int x2=110,x3=150;
public void paint(Graphics g){
for(i=1;i<=4;i++){
g.setColor(Color.RED);
g.drawLine(x,10,x1,10);
g.setColor(Color.BLUE);
g.drawLine(x2,10,x3,10);
x=x+10;
x1=x1+10;
x2=x2-10;
x3=x3-10;
repaint();
}
}
}
But the problem here is that it gets repainted and i see nothing...IS THERE A WAY TO PAUSE EVERYTIME THE LINES ARE DRAWN so that one can see whats happening?