URGENT: Problem in Applet using awt - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

URGENT: Problem in Applet using awt

darksid3rdarksid3r Posts: 1Member
[b]

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..[/b]

[color=Blue]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();
}
}
}[/color]

[color=Red]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?[/color]

Comments

Sign In or Register to comment.