Home Ask Login Register

Developers Planet

Your answer is one click away!

Saurabh Singh February 2016

Audio Applet playing music error

In java applet Music not playing.I get this error and I am not understanding why this error coming.how can I solve this.

i get these errors...........

a.getAudioClip(x,"sound.wav");

symbol: method getAudioClip(URL,String)

location: variable a of type AudioClip

1 error

import java.awt.*;
import java.applet.*;
import java.net.*;
/*
<applet code="AudioApplet.java" height=500 width=400>
</applet> 
*/
public class AudioApplet extends Applet
{
AudioClip a;
public void paint(Graphics g)
{
g.drawString("play music",20,40);
URL x=getCodeBase();
URL y=getDocumentBase();
a.getAudioClip(x,"sound.wav");
g.drawString(x+"",20,100);
g.drawString(y+"",20,150);
a.play();
showStatus("playing..........");
}
public void stop()
{
a.stop();
}
}

Answers


AmanKumar February 2016

Replace . with =

a.getAudioClip(x,"sound.wav"); ---- > a=getAudioClip(x,"sound.wav");

Post Status

Asked in February 2016
Viewed 3,154 times
Voted 14
Answered 1 times

Search




Leave an answer


Quote of the day: live life