|
-
August 14th, 2001, 02:58 AM
#5
Re: Playing Sound from Applet
Dear Norm
Thank you for reply. As you ask I use this things.
JDK 1.2.2
Internet Explorer Version: 6.0.2462.0000
OS Name: Microsoft Windows Whistler Beta Professional
When I try to Compile my Code it give me this error:
MySound.java:20: Can’t make static reference to method java.applet.AudioClip getAudioClip(java.net.URL, java.lang.String) in class java.applet.Applet.
My Code is:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code="MySound" width=200 height=200>
</applet>
*/
public class MySound extends Applet implements ActionListener {
Button bPlay;
AudioClip audioClip;
public void init() {
bPlay = new Button("Play Sound");
audioClip = Applet.getAudioClip(getCodeBase(),"gradually.wav");
add(bPlay);
bPlay.addActionListener(this);
}
public void actionPerformed(ActionEvent ae) {
if(ae.getSource() == bPlay) {
audioClip.play();
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|