Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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]
Sign In or Register to comment.