import java.awt.*; import java.applet.*; import java.io.*; import java.awt.event.*; public class Joonistus1 extends Applet implements MouseListener{ public Joonistus1(){ addMouseListener(this); } public void paint(Graphics g){ g.fillOval(10, 20, 30, 60); g.fillOval(10, 60, 30, 100); g.setColor(Color.white); g.fillOval(20, 70, 10, 10); g.fillOval(20, 90, 10, 10); g.fillOval(20, 110, 10, 10); g.fillOval(20, 130, 10, 10); g.setColor(Color.black); g.fillOval(10, 142, 30, 20); } public void mousePressed(MouseEvent e){ try{ AudioClip lugu=Applet.newAudioClip( new File("Y:/meedia/naer.wav").toURL() ); lugu.play(); System.out.println("lugu"); }catch(Exception ex){ex.printStackTrace();} repaint(); } public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new Joonistus1()); f.setSize(200, 200); f.setVisible(true); } }