It can contain other Components, just as any Panel can. As Panels (and thus Components), Applets participate in the AWT drawing and event hierarchy.
Applet methods:
play(URL), play(URL, String)
Play the AudioClip corresponding to the specified URL.
getAudioClip(URL), getAudioClip(URL, String)
Return an object that implements the AudioClip interface.
The AudioClip interface:
loop()
Starts playing the clip repeatedly.
play()
Plays the clip once.
stop()
Stops the clip. Works with both looping and one-time sounds.
public String getParameter(String name)
. . .
String windowWidthString = getParameter("WINDOWWIDTH");
if (windowWidthString != null) {
try {
requestedWidth = Integer.parseInt(windowWidthString);
} catch (NumberFormatException e) {
//Use default width.
}
}public String[][] getParameterInfo() {
String[][] info = {
// Parameter Name Kind of Value Description
{"imagesource", "URL", "a directory"},
{"startup", "URL", "displayed at startup"},
{"background", "URL", "displayed as background"},
{"startimage", "int", "start index"},
{"endimage", "int", "end index"},
{"namepattern", "URL", "used to generate indexed names"},
{"pause", "int", "milliseconds"},
{"pauses", "ints", "milliseconds"},
{"repeat", "boolean", "repeat or not"},
{"positions", "coordinates", "path"},
{"soundsource", "URL", "audio directory"},
{"soundtrack", "URL", "background music"},
{"sounds", "URLs", "audio samples"},
};
return info;
}Command to Read System Properties:
String s = System.getProperty("os.name");System Properties that Applets Can Read:
Table 12.1. Available System Properties
| Key | Meaning |
|---|---|
| "file.separator" | File separator (e.g., "/") |
| "java.class.version" | Java class version number |
| "java.vendor" | Java vendor-specific string |
| "java.vendor.url" | Java vendor URL |
| "java.version" | Java version number |
| "line.separator" | Line separator |
| "os.arch" | Operating system architecture |
| "os.name" | Operating system name |
| "path.separator" | Path separator (e.g., ":") |
Forbidden System Properties:
Table 12.2. Forbidden System Properties
| Key | Meaning |
|---|---|
| "java.class.path" | Java classpath |
| "java.home" | Java installation directory |
| "user.dir" | User's current working directory |
| "user.home" | User home directory |
| "user.name" | User account name |
Print in the browser status line:
showStatus("MyApplet: Loading image file " + file);Copyright © 1998-2009 Dilvan Moreira