import java.applet.*;
import java.awt.*;
import java.awt.event.*;


public class piano extends Applet implements ActionListener{
Button A;
Button Csharp;
Button E;
Button G;
Button Asharp;
Button D;
Button F;
Button Gsharp;
Button B;
Button Dsharp;
Button Fsharp;
Button MiddleC;
AudioClip SA; 
AudioClip SCsharp; 
AudioClip SE;
AudioClip SG;
AudioClip SAsharp;
AudioClip SD;
AudioClip SF;
AudioClip SGsharp;
AudioClip SB;
AudioClip SDsharp;
AudioClip SFsharp;
AudioClip SMiddleC;



public void init(){
 
A = new Button("A");
add(A);
A.addActionListener(this);
Csharp = new Button("C Sharp");
add(Csharp);
Csharp.addActionListener(this);
E = new Button("E");
add(E);
E.addActionListener(this);
G = new Button("G");
add(G);
G.addActionListener(this);
Asharp = new Button("A Sharp");
add(Asharp);
Asharp.addActionListener(this);
D = new Button("D");
add(D);
D.addActionListener(this);
F = new Button("F");
add(F);
F.addActionListener(this);
Gsharp = new Button("G Sharp");
add(Gsharp);
Gsharp.addActionListener(this);
B = new Button("B");
add(B);
B.addActionListener(this);
Dsharp = new Button("Dsharp");
add(Dsharp);
Dsharp.addActionListener(this);
Fsharp = new Button("Fsharp");
add(Fsharp);
Fsharp.addActionListener(this);
MiddleC = new Button("Middle C");
add(MiddleC);
MiddleC.addActionListener(this);
 SA = getAudioClip(getDocumentBase(),"A.au");           // convert sounds to au for Java
SCsharp = getAudioClip(getDocumentBase(),"Csharp.au"); 
SE = getAudioClip(getDocumentBase(),"E.au"); 
SG= getAudioClip(getDocumentBase(),"G.au"); 
SAsharp = getAudioClip(getDocumentBase(),"Asharp.au"); 
SD = getAudioClip(getDocumentBase(),"D.au"); 
SF = getAudioClip(getDocumentBase(),"F.au"); 
SGsharp = getAudioClip(getDocumentBase(),"Gsharp.au"); 
SB = getAudioClip(getDocumentBase(),"B.au"); 
SDsharp = getAudioClip(getDocumentBase(),"Dsharp.au"); 
SFsharp = getAudioClip(getDocumentBase(),"Fsharp.au"); 
SMiddleC = getAudioClip(getDocumentBase(),"MiddleC.au"); 

}

public void actionPerformed(ActionEvent e){
if(e.getSource()==A)
 {SA.play();}
 if(e.getSource()==Csharp)
 {SCsharp.play();}
 if(e.getSource()==E)
 {SE.play();}
 if(e.getSource()==G)
 {SG.play();}
 if(e.getSource()==Asharp)
 {SAsharp.play();}
 if(e.getSource()==D)
 {SD.play();}
 if(e.getSource()==F)
 {SF.play();}
 if(e.getSource()==Gsharp)
 {SGsharp.play();}
 if(e.getSource()==B)
 {SB.play();}
 if(e.getSource()==Dsharp)
 {SDsharp.play();}
 if(e.getSource()==Fsharp)
 {SFsharp.play();}
 if(e.getSource()==MiddleC)
 {SMiddleC.play();}
}
}