import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class joon extends Applet implements ActionListener{ TextField p1x1=new TextField("3",2); TextField p1y1=new TextField("4",2); TextField p1x2=new TextField("5",2); TextField p1y2=new TextField("6",2); TextField p2x1=new TextField("7",2); TextField p2y1=new TextField("8",2); TextField p2x2=new TextField("9",2); TextField p2y2=new TextField("10",2); Label La1=new Label("1. joone algus"); Label La2=new Label("1. joone lõpp"); Label La3=new Label("2. joone algus"); Label La4=new Label("2. joone lõpp"); Label tulemus=new Label(" Andme väli "); Button nupp=new Button("Joonista"); boolean ristuvad=false; int x1,x2,x3,x4,y1,y2,y3,y4; double x=0,y=0; public joon(){ add(La1); add(p1x1); add(p1y1); add(La2); add(p1x2); add(p1y2); add(La3); add(p2x1); add(p2y1); add(La4); add(p2x2); add(p2y2); add(tulemus); add(nupp); nupp.addActionListener(this); } public void actionPerformed(ActionEvent syndmus){ x1=Integer.parseInt(p1x1.getText()); x2=Integer.parseInt(p1x2.getText()); x3=Integer.parseInt(p2x1.getText()); x4=Integer.parseInt(p2x2.getText()); y1=Integer.parseInt(p1y1.getText()); y2=Integer.parseInt(p1y2.getText()); y3=Integer.parseInt(p2y1.getText()); y4=Integer.parseInt(p2y2.getText()); if ((x2-x1)==0 || (x4-x3)==0){ if ((x2-x1)==(x4-x3)){ tulemus.setText("Paralleelsed"); }else{ tulemus.setText("Ei ole paralleelsed"); } }else if ((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){ tulemus.setText("Paralleelsed"); }else{ tulemus.setText("Ei ole paralleelsed"); } for (double i=x1;i<=x2;i=i+0.01){ if (x1==x2 && y3<(((i-x3)*(y4-y3))/(x4-x3)+y3) && (((i-x3)*(y4-y3))/(x4-x3)+y3)