/*<applet code = DDA height = 400 width = 400>
</applet>*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class DDA extends Applet implements ActionListener {
int x1,x2,y1,y2,step,dx,dy;
float xinc,yinc,X,Y;
Label l1 = new Label("x1 = ");
Label l2 = new Label("x2 = ");
Label l3 = new Label("y1 = ");
Label l4 = new Label("y2 = ");
TextField t1 = new TextField(3);
TextField t2 = new TextField(3);
TextField t3 = new TextField(3);
TextField t4 = new TextField(3);
Button b = new Button("DRAW");
public void init(){
add(l1);
add(t1);
add(l2);
add(t2);
add(l3);
add(t3);
add(l4);
add(t4);
add(b);
b.addActionListener(this);
}
public void paint (Graphics g){
x1=Integer.parseInt(t1.getText());
x2=Integer.parseInt(t2.getText());
y1=Integer.parseInt(t3.getText());
y2=Integer.parseInt(t4.getText());
dx=x2-x1;
dy=y2-y1;
if(Math.abs(dx)>Math.abs(dy))
step=Math.abs(dx);
else
step=Math.abs(dy);
xinc=(float)dx/step;
yinc=(float)dy/step;
X=x1;
Y=y1;
//g.setColor(Color.Red);
g.drawString(".",(int)X,(int)Y);
for(int i=1;i<step;i++)
{
X=X+xinc;
Y=Y+yinc;
//g.setColor(Color.RED);
g.drawString(".",(int)X,(int)Y);
}
}
public void actionPerformed(ActionEvent a)
{
repaint();
}
}
good job
ReplyDeleteGood Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletehadoop training in chennai
hadoop training in annanagar
salesforce training in chennai
salesforce training in annanagar
c and c plus plus course in chennai
c and c plus plus course in annanagar
machine learning training in chennai
machine learning training in annanagar
I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article.
ReplyDeletehardware and networking training in chennai
hardware and networking training in tambaram
xamarin training in chennai
xamarin training in tambaram
ios training in chennai
ios training in tambaram
iot training in chennai
iot training in tambaram
I like the helpful info you supply in your articles. I’ll bookmark your weblog and take a look at once more here regularly. I am relatively certain I will learn a lot of new stuff right here! Good luck for the following!
ReplyDeletedata science training in chennai
data science training in velachery
android training in chennai
android training in velachery
devops training in chennai
devops training in velachery
artificial intelligence training in chennai
artificial intelligence training in velachery
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteweb designing training in chennai
web designing training in omr
digital marketing training in chennai
digital marketing training in omr
rpa training in chennai
rpa training in omr
tally training in chennai
tally training in omr
perde modelleri
ReplyDeleteMobil onay
mobil ödeme bozdurma
nft nasıl alınır
Ankara evden eve nakliyat
trafik sigortası
dedektör
web sitesi kurma
aşk kitapları