On Tuesday 16 January 2007 2:39 pm, [EMAIL PROTECTED] wrote: Hello,
> Now i need to call a Java-method from within my JavaScript and call a > JavaScript-method from Java. > What is the simplest way to do this? I have read something that it is > possible with JavaXPCOM or LiveConnect. But I don't know what is > easyer, better and how to do it. As you mentioned there are two methods: Using XPCOM: you have to create two XPCOM components, that is - create two IDL interfaces - then implement one component in java (i.e. using javaxpcom) - and second component in javascript (i.e. using xpconnect) Using LiveConnect: this approach is the same as the communication between javascript code and java applet inside one HTML page. > When I run my Java-App with the shown code it stops at the line > [code]appStartup.run();[/code] > when my gui is displayed until I close the window. Yes, that is correct, the run() method spins the gui event loop. > Can I call another Java-method from JavaScript although the app stops > at lthis line? And what if I want to call a JavaScript-method from Java > now? You have to get some callback running on the GUI thread and execute your code there. E.g. some button or timeout handler. Eventually, you can use xpcom proxies: http://www.mozilla.org/projects/xpcom/Proxies.html best regards, Michal _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
