Java Example Program / Sample Source Code
import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AudioClip;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
public class ContextStreamExample implements AppletContext {
public AudioClip getAudioClip(URL url) {
return Applet.newAudioClip(url);
}
public Image getImage(URL url) {
Toolkit toolKit = Toolkit.getDefaultToolkit();
return toolKit.getImage(url);
}
public Applet getApplet(String name) {
return null;
}
public Enumeration<Applet> getApplets() {
return null;
}
public void showDocument(URL url) {
System.out.println("Showing document " + url);
}
public void showDocument(URL url, String target) {
try {
showDocument(new URL(url.toString() + target));
} catch (MalformedURLException e) {
}
}
public void showStatus(String status) {
System.out.println(status);
}
public void setStream(String key, InputStream stream) throws IOException {
}
public InputStream getStream(String key) {
return null;
}
public Iterator<String> getStreamKeys() {
return null;
}
} |
|
|