//Ojari Kodutöö: import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class t66 extends Applet implements ActionListener{ double s,a,h; int n, kp; TextField nurgad = new TextField(); TextField kpikkus = new TextField(); Button nupp = new Button("Pindala:"); TextField vastus = new TextField(); Label lnurgad = new Label("Nurkade arv:"); Label lkpikkus = new Label("Külje pikkus:"); Nurgad nr1 = new Nurgad(7); public void init(){ Panel p=new Panel(); p.setLayout(new java.awt.GridLayout(3,2)); p.add(lnurgad); p.add(nurgad); p.add(lkpikkus); p.add(kpikkus); p.add(nupp); p.add(vastus); setLayout(new BorderLayout()); add(p, BorderLayout.NORTH); // add(new Label("Hulknurk")); add(nr1, BorderLayout.CENTER); nupp.addActionListener(this); } public void paint(Graphics g){ } public void actionPerformed(ActionEvent e){ n = Integer.parseInt(nurgad.getText()); kp = Integer.parseInt(kpikkus.getText()); double h=((Math.sqrt(3.0)/2.0*kp)); double s=((kp*h)/2)*n; String abi=s+""; vastus.setText(abi.substring(0, 5)); nr1.muudaNurkadeArv(n); } }