RIYA tr
RIYA tr

Reputation: 7

Error while running in applet context

This program is intended to produce a beep sound using applet context. I got error cannot find the symbol METHOD SetAudioClip(URL,string). Please explain what is url and string in these case.

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

public class Boops extends Applet implements MouseListener
{

AudioClip c;

public void init()
{
    c=SetActionClip(getCodeBase(),"beep.ac");
    addMouseListener(this);
}

public void mouseClicked(MouseEvent e)
{
    c.play();
}

Upvotes: 0

Views: 77

Answers (2)

Jarlax
Jarlax

Reputation: 1576

Just remove white space in Set ActionClip:

c=SetActionClip(getCodeBase(),"beep.ac");

Upvotes: 1

Andrew Thompson
Andrew Thompson

Reputation: 168825

error ; missing at c=Set ActionClip(getCodeBase(),"beep.ac"); 

Use Applet.getAudioClip(URL,String) instead, which:

Returns the AudioClip object specified by the URL and name arguments.

Upvotes: 1

Related Questions