Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing JS function to applet for as event listener

Is it possible to pass a function/callback from javascript to a java applet?

For example i have an applet with a button that when pressed it will call the passed js callback

function onCommand() {
  alert('Button pressed from applet');
}
applet.onCommand(onCommand);
like image 956
ken Avatar asked Dec 30 '22 10:12

ken


1 Answers

I tend to use something I derived from the reflection example at the bottom of this page, as then you don't need to meddle with your classpath to get it to compile

Then I just pass JSON strings around between the applet and javascript

like image 109
tim_yates Avatar answered Jan 02 '23 00:01

tim_yates