import sun.audio.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class Sample {
public static void main(String s[]) {
JFrame frame = new JFrame ();
frame.setSize(200,200);
JButton justin = new JButton ("Click Here for Welcoming");
frame.add(justin);
justin.addActionListener(new AL());
}
public static class AL implements ActionListener{
public final void actionPerformed(ActionEvent e){
music();
}}
public static void music(){
AudioPlayer MGP;
AudioStream BGM;
AudioData MD;
ContinouosAudioDataStream loop = null;
try{
BGM = new AudioStream (new FileInputStream ("aircraft001.wav"));
MD = BGM.getData();
loop = new ContinuousAudioDataStream(MD);
}catch (IOExcepiton error){}
MPG.start (loop);
}
}
}
theres an error with our program, and we dont know why and how, we just tried to follow the instructions of the tutorial!! hope u can help us! thank you!
this is the error that we are getting:
Access restriction: The type AudioPlayer is not accessible due to restriction on required library C:\Program
Files\Java\jre7\lib\rt.jar
and:
Multiple markers at this line
- Access restriction: The type AudioStream is not accessible due to restriction on required
library C:\Program Files\Java\jre7\lib\rt.jar
- Access restriction: The constructor AudioStream(InputStream) is not accessible due to
restriction on required library C:\Program Files\Java\jre7\lib\rt.jar
and also:
MPG cannot be resolved
thank you please help us!