/* 
 * 1.1 version.
 */

import java.applet.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class phone extends Applet 
			  implements ActionListener {
	Button b0;
	Button b1;
	Button b2;
	Button b3;
	Button b4;
	Button b5;
	Button b6;
	Button b7;
	Button b8;
	Button b9;

    public void init() {
		b0 = new Button("0"); b0.addActionListener(this); add(b0);
		b1 = new Button("1"); b1.addActionListener(this); add(b1);
		b2 = new Button("2"); b2.addActionListener(this); add(b2);
		b3 = new Button("3"); b3.addActionListener(this); add(b3);
		b4 = new Button("4"); b4.addActionListener(this); add(b4);
		b5 = new Button("5"); b5.addActionListener(this); add(b5);
		b6 = new Button("6"); b6.addActionListener(this); add(b6);
		b7 = new Button("7"); b7.addActionListener(this); add(b7);
		b8 = new Button("8"); b8.addActionListener(this); add(b8);
		b9 = new Button("9"); b9.addActionListener(this); add(b9);
	}
    public void actionPerformed(ActionEvent event) {
		Object source = event.getSource();

		AudioClip note=null;

		// b0 button
		if (source == b0) 
		{
			note = this.getAudioClip(getCodeBase(), "0.au");
		}

		// b1 button
		if (source == b1) 
		{
			note = this.getAudioClip(getCodeBase(), "1.au");
		}

		// b2 button
		if (source == b2) 
		{
			note = this.getAudioClip(getCodeBase(), "2.au");
		}

		// b3 button
		if (source == b3) 
		{
			note = this.getAudioClip(getCodeBase(), "3.au");
		}

		// b4 button
		if (source == b4) 
		{
			note = this.getAudioClip(getCodeBase(), "4.au");
		}

		// b5 button
		if (source == b5) 
		{
			note = this.getAudioClip(getCodeBase(), "5.au");
		}

		// b6 button
		if (source == b6) 
		{
			note = this.getAudioClip(getCodeBase(), "6.au");
		}

		// b7 button
		if (source == b7) 
		{
			note = this.getAudioClip(getCodeBase(), "7.au");
		}

		// b8 button
		if (source == b8) 
		{
			note = this.getAudioClip(getCodeBase(), "8.au");
		}

		// b9 button
		if (source == b9) 
		{
			note = this.getAudioClip(getCodeBase(), "9.au");
		}

		if(note != null)
		{
			note.play();     //Play it once.
			showStatus("Done playing sound");
		}
		else
		{
			showStatus("Error loading the clip");
		}
    }
}
