We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › JSObject.getWindow()
Page Index Toggle Pages: 1
JSObject.getWindow() (Read 1517 times)
JSObject.getWindow()
Oct 16th, 2007, 12:28pm
 
I'm trying to set up my applet so that it can call a JavaScript method if it is online. The best way seems to be the use of JSObject but i'm having problems getting it working.

i have a class

Code:

public class JSTest extends PApplet
{


public void setup(){




size(400, 400);


background(255,0,255);


stroke(255,255,255);



initialize();

}


private void initialize()

{

if (online)


{






JSObject jso = JSObject.getWindow(this);



jso.call("getXML", null);





}

}

}


This throws the error at netscape.javascript.JSObject.getWindow(Unknown Source)

Does PApplet extends java.applet.Applet? Is there anything else wrong with this that you can see?

Cheers
Jimmy



Re: JSObject.getWindow()
Reply #1 - Oct 16th, 2007, 12:42pm
 
have a look there:

http://trac.appletobject.org/appletobject/browser/trunk/AppletObject/java/org/appletobject/AppletObjectHelper.java

should have mentioned that the important parts (try-blocks) are in callback( .. )

F
Re: JSObject.getWindow()
Reply #2 - Oct 16th, 2007, 1:36pm
 
cheers dude... gave up of JSObject and went with this#


Code:

try
{

java.applet.AppletContext context = getAppletContext();
if ( context != null )
{
context.showDocument(new java.net.URL("javascript:getXML()"), "_self" );
}

} catch (Exception ignore) {

}
Page Index Toggle Pages: 1