If you are in control of the deployment of the applet (I.e. the webpage hosting the applet), you could write your own Applet Launcher. The launcher functions as a wrapper that provides a custom environment to the actual applet. The launcher instantiates the real applet and passes to it customized versions of the applet environment (AppletStub, AppletContext.) The custom environment implements AudioClip as a "do nothing" interface.
To disable audio, you could override the AppletContext like this:
class CustomAppletContext implements AppletContext
{
AppletContext realContext;
// most methods delegate to the real context, either directly, or with a little modification to hide the fact that we are using this launcher
public void setStatus(String status)
{
realContext.setStatus(status);
}
// override the getAudioClip to return a dummy clip
public AudioClip getAudioClip(URl url)
{
return new DummyAudioClip();
}
}
// An AudioClip implementation that does nothing
class DummyAudioClip implements AudioClip
{
public void loop() { }
public void play() { }
public void stop() { }
}
We also override AppletStub, since this is where the Applet gets the AppletContext from
class CustomAppletStub implements AppletStub
{
AppletStub realStub;
public AppletContext getAppletContext()
{
return new CustomAppletContext(realStub.getAppletContext());
}
}
And then, your launcher:
class AppletLauncher extends Applet
{
private Applet realApplet = new NoisyApplet();
// delegate most methods to the applet, but override the stub, to inject our
// AppletContext and AudioClip implementation
public void setAppletStub(AppletStub stub)
{
realApplet.setAppletStub(new CustomAppletStub(stub));
}
}
It looks like a lot of code, but it's really just a few classes and mostly wiring just to inject a new DummyAudioClip implementation.
HTH!