See: Description
Class | Description |
---|---|
WWJApplet |
Illustrates the how to display a World Wind
in a Java Applet and interact with the
WorldWindow through JavaScript code running in the browser. |
WWJAppletMinimal |
Illustrates the simplest possible way to display a World Wind
in a Java Applet. |
Examples of a displaying a World Wind globe in a Java Applet. Instructions for deploying Applets and live Applet examples are available at http://goworldwind.org. Important links for Applets on goworldwind.org:
The WWJApplet and WWJAppletMinimal classes in this package demonstate how to display a WorldWindow inside a Java Applet, and how to communicate between the Applet and the browser. The documents WWJApplet.html and WWJApplet.jnlp in the demos folder demonstrate how to embed a World Wind Applet in a web page.
Applet parameters can be specified in HTML via the applet or object tag using the param field.
<param name="key" value="value">
The Applet can then retrieve this parameter using Applet's getParameter method.
String value = getParameter("key");
This section provides a basic overview of communication between a Java Applet and the browser's Javascript runtime,
referred to as LiveConnect. For more information see Oracle's Java Applet tutorial at
http://docs.oracle.com/javase/tutorial/deployment/applet/index.html
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {id:'appletId', mayscript:'true', ...};
var parameters = ...;
deployJava.runApplet(attributes, parameters, '1.6'); // runApplet automatically looks for JRE 1.6+
</script>
// Provide a common method for accessing the World Wind applet.
var theApplet = null;
function getApplet()
{
if (theApplet == null)
{
theApplet = document.getElementById('appletId'); // id attribute specified in the applet tag.
}
return theApplet;
}
// Call the Java Applet method doSomething() from Javascript.
getApplet().doSomething();
import netscape.javascript.JSObject;
// Call the Javascript doSomethingJS method from the Java Applet.
JSObject win = JSObject.getWindow(this);
win.call("doSomethingJS", null);
// Evaluate and execute Javascript code as a string.
win.eval("alert('An alert message')");