import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Autosoit5 extends Applet implements ActionListener{ AutoAndmed masin1=new AutoAndmed(); Button vasaknupp=new Button("Keera vasakule"); Button paremnupp=new Button("Keera paremale"); public Autosoit5(){ add(vasaknupp); add(paremnupp); vasaknupp.addActionListener(this); paremnupp.addActionListener(this); } public void paint(Graphics g){ masin1.joonista(g); } public void actionPerformed(ActionEvent e){ if(e.getSource()==vasaknupp){masin1.vasakule();} if(e.getSource()==paremnupp){masin1.paremale();} repaint(); } public static void main(String[] arg){ Frame f=new Frame("Iseseisev auto"); f.add(new Autosoit5()); f.setSize(300, 300); f.setVisible(true); } }