Skip to content

Instantly share code, notes, and snippets.

@unscriptable
Created December 20, 2010 20:28
Show Gist options
  • Select an option

  • Save unscriptable/748930 to your computer and use it in GitHub Desktop.

Select an option

Save unscriptable/748930 to your computer and use it in GitHub Desktop.
How to communicate between javascript and java applet
var myApplet = funcToGetApplet();
myApplet.setCallback({
myMethod: function (args) {
// do something with args here
},
anotherMethod: function (args) {
// do something with args here
}
});
// in the applet:
public void setCallback (JSObject cbObj) {
this.cbObj = cbObj;
}
public void callMyMethod (arg1, arg2, arg3) {
Object[] args = { arg1, arg2, arg3 };
this.cbObj.call("myMethod", args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment